指令适配新的列车操作方式
This commit is contained in:
parent
f240238e56
commit
6872f9b7bf
@ -402,8 +402,8 @@ public class Operation {
|
|||||||
Driver_ATO_Open,
|
Driver_ATO_Open,
|
||||||
/** 改变ATP状态 */
|
/** 改变ATP状态 */
|
||||||
Driver_ATP_Change,
|
Driver_ATP_Change,
|
||||||
/** 改变列车运行模式 */
|
// /** 改变列车运行模式 */
|
||||||
Driver_Drive_Mode_Change,
|
// Driver_Drive_Mode_Change,
|
||||||
/** 换端 */
|
/** 换端 */
|
||||||
Driver_Change_Head,
|
Driver_Change_Head,
|
||||||
/** 列车车门开关 */
|
/** 列车车门开关 */
|
||||||
|
@ -34,7 +34,7 @@ public class DriverOperateHandler {
|
|||||||
// if (train.isSignalEB() && percent == -2)
|
// if (train.isSignalEB() && percent == -2)
|
||||||
// ATPService.cancelSignalEB(train);
|
// ATPService.cancelSignalEB(train);
|
||||||
if ((percent <= 1 && percent >= -1) || percent == -2) {
|
if ((percent <= 1 && percent >= -1) || percent == -2) {
|
||||||
train.setControlLeaver(percent);
|
train.setLeverPosition(percent);
|
||||||
}
|
}
|
||||||
if (train.isEB()) {
|
if (train.isEB()) {
|
||||||
return;
|
return;
|
||||||
@ -53,12 +53,8 @@ public class DriverOperateHandler {
|
|||||||
train.leaverUpdateTBForce(0, 350);
|
train.leaverUpdateTBForce(0, 350);
|
||||||
} else {
|
} else {
|
||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument,
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument,
|
||||||
String.format("数值[%s]超限,列车牵引/制动力可调整比例范围应该在[-1, 1]之间,或为紧急制动-2", percent));
|
String.format("数值[%s]超限,列车牵引/制动力可调整比例范围应该在[-1, 1]之间,或为快速制动-2", percent));
|
||||||
}
|
}
|
||||||
if (train.isAtoOn()) {
|
|
||||||
ATPService.closeATO(train);
|
|
||||||
}
|
|
||||||
train.setLeverPosition(percent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateHandlerMapping(type = Operation.Type.Driver_EB)
|
@OperateHandlerMapping(type = Operation.Type.Driver_EB)
|
||||||
|
@ -4,7 +4,6 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
|||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
||||||
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||||
@ -154,7 +153,6 @@ public class CommandBO {
|
|||||||
|
|
||||||
List<Step> stepList = new ArrayList<>();
|
List<Step> stepList = new ArrayList<>();
|
||||||
stepList.add(buildDriverForceChangeOperationStep(train.getGroupNumber(), 0));
|
stepList.add(buildDriverForceChangeOperationStep(train.getGroupNumber(), 0));
|
||||||
stepList.add(buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM));
|
|
||||||
if (section.isStandTrack()) { //如果列车的车头所在区段是站台轨
|
if (section.isStandTrack()) { //如果列车的车头所在区段是站台轨
|
||||||
SectionPosition standStopPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
SectionPosition standStopPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||||
if (train.isStopAtThePosition(standStopPosition)) { //列车已经停在站台停车点
|
if (train.isStopAtThePosition(standStopPosition)) { //列车已经停在站台停车点
|
||||||
@ -177,7 +175,6 @@ public class CommandBO {
|
|||||||
train.debugStr() + "找不到下一个停车点");
|
train.debugStr() + "找不到下一个停车点");
|
||||||
stepList.add(buildDriveStep(nextStopPosition));
|
stepList.add(buildDriveStep(nextStopPosition));
|
||||||
}
|
}
|
||||||
stepList.add(buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM));
|
|
||||||
stepList.add(buildRmToBmStep());
|
stepList.add(buildRmToBmStep());
|
||||||
|
|
||||||
return stepList;
|
return stepList;
|
||||||
@ -186,16 +183,18 @@ public class CommandBO {
|
|||||||
@Override
|
@Override
|
||||||
public Step execute(Simulation simulation, CommandBO command) {
|
public Step execute(Simulation simulation, CommandBO command) {
|
||||||
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
||||||
//如果列车没停到目标位置,先想办法开过去---
|
|
||||||
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
||||||
Step driveStep = steps.get(0);
|
Step driveStep = steps.get(0);
|
||||||
if (!train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车没停到目标位置
|
if (!train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车没停到目标位置
|
||||||
|
if (!train.isInTheGear(Handwheel.MANUAL)) {
|
||||||
|
return buildGearChangeStep(train.getGroupNumber(), Handwheel.MANUAL);
|
||||||
|
}
|
||||||
if (!train.isStop())
|
if (!train.isStop())
|
||||||
return buildDriverForceChangeOperationStep(train.getGroupNumber(), -1);
|
return buildDriverForceChangeOperationStep(train.getGroupNumber(), -1);
|
||||||
if (!DriveMode.RM.equals(train.getDriveMode()) && !train.isNRMMode())
|
if (!DriveMode.RM.equals(train.getDriveMode()) && !train.isNRMMode())
|
||||||
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM);
|
return getStep4ChangePreselectionMode(train, PreselectionMode.RM);
|
||||||
if (train.isEB())
|
if (train.isEB())
|
||||||
return buildReleaseEBStep(train);
|
return getStep4ReleaseEB(train);
|
||||||
return driveStep;
|
return driveStep;
|
||||||
} else { //如果列车已经停到目标位置
|
} else { //如果列车已经停到目标位置
|
||||||
// if (!DriveMode.AM.equals(train.getDriveMode()))
|
// if (!DriveMode.AM.equals(train.getDriveMode()))
|
||||||
@ -212,26 +211,16 @@ public class CommandBO {
|
|||||||
Route_Block_Drive(Collections.emptyList(), SimulationMember.Type.DRIVER) {
|
Route_Block_Drive(Collections.emptyList(), SimulationMember.Type.DRIVER) {
|
||||||
@Override
|
@Override
|
||||||
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
||||||
List<Step> stepList = new ArrayList<>();
|
return Collections.emptyList();
|
||||||
VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
|
||||||
stepList.add(buildDriverForceChangeOperationStep(train.getGroupNumber(), 0));
|
|
||||||
stepList.add(buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM));
|
|
||||||
stepList.add(buildDriverAtoOpenOperationStep(train.getGroupNumber()));
|
|
||||||
|
|
||||||
return stepList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Step execute(Simulation simulation, CommandBO command) {
|
public Step execute(Simulation simulation, CommandBO command) {
|
||||||
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
||||||
if (!DriveMode.CM.equals(train.getDriveMode()) && !DriveMode.AM.equals(train.getDriveMode())) { //如果列车不处于CM/AM运行级别
|
if (train.isAMMode()) {
|
||||||
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM);
|
|
||||||
}
|
|
||||||
if (!train.isAtoOn()) { //列车ATO没开
|
|
||||||
return buildDriverAtoOpenOperationStep(train.getGroupNumber());
|
|
||||||
}
|
|
||||||
if (RunLevel.CBTC.equals(train.getRunLevel())) { //列车的运行级别为CBTC时,结束指令
|
|
||||||
command.getTargetMember().setCommand(null);
|
command.getTargetMember().setCommand(null);
|
||||||
|
} else {
|
||||||
|
getStep4ChangePreselectionMode(train, PreselectionMode.AM_C);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -299,23 +288,12 @@ public class CommandBO {
|
|||||||
if (stopCorrectly) { //如果列车已经停到目标位置
|
if (stopCorrectly) { //如果列车已经停到目标位置
|
||||||
driveStep.finish();
|
driveStep.finish();
|
||||||
command.getTargetMember().setCommand(null);
|
command.getTargetMember().setCommand(null);
|
||||||
// if (RunLevel.ITC.equals(train.getRunLevel()) || RunLevel.CBTC.equals(train.getRunLevel())) {
|
|
||||||
// Step upgradeStep = getStepOfRm2BmAndOpenAtoWhileStopAtStopPosition(command);
|
|
||||||
// if (upgradeStep != null) {
|
|
||||||
// return upgradeStep;
|
|
||||||
// } else if (train.isAtoOn()) {
|
|
||||||
// command.getTargetMember().setCommand(null);
|
|
||||||
// return buildAtoTurnDirectionStep();
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// command.getTargetMember().setCommand(null);
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
if (!DriveMode.RM.equals(train.getDriveMode()) && !train.isNRMMode()) {
|
if (!DriveMode.RM.equals(train.getDriveMode()) && !train.isNRMMode()) {
|
||||||
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM);
|
return getStep4ChangePreselectionMode(train, PreselectionMode.RM);
|
||||||
}
|
}
|
||||||
if (train.isSignalEB()) {
|
if (train.isSignalEB()) {
|
||||||
return buildReleaseEBStep(train);
|
return getStep4ReleaseEB(train);
|
||||||
}
|
}
|
||||||
return driveStep;
|
return driveStep;
|
||||||
}
|
}
|
||||||
@ -337,7 +315,6 @@ public class CommandBO {
|
|||||||
VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
||||||
stepList.add(buildDriveStep(train.calculateStepPosition4CrossTheGuideSignal()));
|
stepList.add(buildDriveStep(train.calculateStepPosition4CrossTheGuideSignal()));
|
||||||
stepList.add(buildCrossSignalStep(train.getHeadPosition().getSection().getSignalOf(train.isRight())));
|
stepList.add(buildCrossSignalStep(train.getHeadPosition().getSection().getSignalOf(train.isRight())));
|
||||||
stepList.add(buildRmToBmStep());
|
|
||||||
|
|
||||||
return stepList;
|
return stepList;
|
||||||
}
|
}
|
||||||
@ -345,29 +322,30 @@ public class CommandBO {
|
|||||||
@Override
|
@Override
|
||||||
public Step execute(Simulation simulation, CommandBO command) {
|
public Step execute(Simulation simulation, CommandBO command) {
|
||||||
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
||||||
Step crossSignalStep = command.getStepByType(Step.StepType.CROSS_SIGNAL).get(0);
|
// Step crossSignalStep = command.getStepByType(Step.StepType.CROSS_SIGNAL).get(0);
|
||||||
Signal signal = crossSignalStep.getCrossSignal();
|
// Signal signal = crossSignalStep.getCrossSignal();
|
||||||
SectionPosition signalPosition = new SectionPosition(signal.getSection(), signal.getOffset());
|
// SectionPosition signalPosition = new SectionPosition(signal.getSection(), signal.getOffset());
|
||||||
if (train.getHeadPosition().isAheadOf(signalPosition, train.isRight())) { //如果已经越过了信号机
|
// if (train.getHeadPosition().isAheadOf(signalPosition, train.isRight())) { //如果已经越过了信号机
|
||||||
Step step = getStepOfRm2BmAndOpenAto(command);
|
// if (train.isAMMode()) {
|
||||||
if (step != null) {
|
// command.getTargetMember().setCommand(null);
|
||||||
return step;
|
// } else {
|
||||||
}
|
// return getStep4ChangePreselectionMode(train, PreselectionMode.AM_C);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (!train.isRMMode() && !train.isNRMMode()) { //既不是RM也不是NRM,切换预选模式
|
||||||
|
return getStep4ChangePreselectionMode(train, PreselectionMode.RM);
|
||||||
}
|
}
|
||||||
if (!PreselectionMode.RM.equals(train.getPreselectionMode())) {
|
if (!train.isInTheGear(Handwheel.MANUAL)) { //转手轮
|
||||||
PreselectionMode tempMode = train.getTempPreselectionMode();
|
return buildGearChangeStep(train.getGroupNumber(), Handwheel.MANUAL);
|
||||||
if (!PreselectionMode.RM.equals(tempMode)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
||||||
Step driveStep = steps.get(0);
|
Step driveStep = steps.get(0);
|
||||||
if (train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车已经停到目标位置
|
if (train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车已经停到目标位置
|
||||||
command.getTargetMember().setCommand(null);
|
command.getTargetMember().setCommand(null);
|
||||||
return null;
|
|
||||||
} else {
|
} else {
|
||||||
return driveStep;
|
return driveStep;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -393,7 +371,6 @@ public class CommandBO {
|
|||||||
} else if (!train.getDoorByDirection(true).isCloseAndLock()) { //列车右门没关
|
} else if (!train.getDoorByDirection(true).isCloseAndLock()) { //列车右门没关
|
||||||
stepList.add(buildDoorOnOffOperationStep(train.getGroupNumber(), true, false));
|
stepList.add(buildDoorOnOffOperationStep(train.getGroupNumber(), true, false));
|
||||||
} else {
|
} else {
|
||||||
// 根据站台方向位置和列车方向,同步开屏蔽门、车门
|
|
||||||
boolean doorIsRight;
|
boolean doorIsRight;
|
||||||
for (Stand stand : standList) {
|
for (Stand stand : standList) {
|
||||||
if (stand.isInside() && stand.isRight()) { // 内测右站台,开1门
|
if (stand.isInside() && stand.isRight()) { // 内测右站台,开1门
|
||||||
@ -474,7 +451,9 @@ public class CommandBO {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 驾驶至 */
|
/**
|
||||||
|
* 驾驶至
|
||||||
|
*/
|
||||||
Drive_To(List.of(ParamName.sectionCode), SimulationMember.Type.DRIVER) {
|
Drive_To(List.of(ParamName.sectionCode), SimulationMember.Type.DRIVER) {
|
||||||
@Override
|
@Override
|
||||||
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
||||||
@ -497,100 +476,9 @@ public class CommandBO {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// /** 转URM模式 */
|
/**
|
||||||
// Apply_URM_Mode(List.of(), SimulationMember.Type.DRIVER) {
|
* 回库
|
||||||
// @Override
|
*/
|
||||||
// public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
|
||||||
// return List.of();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
|
|
||||||
// VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
|
||||||
// if (train.isNRMMode()) {
|
|
||||||
// command.getTargetMember().setCommand(null);
|
|
||||||
// return null;
|
|
||||||
// } else {
|
|
||||||
// return buildDriverATPChangeOperationStep(train.getGroupNumber(), true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
//
|
|
||||||
// /** 转RM模式 */
|
|
||||||
// Apply_RM_Mode(List.of(), SimulationMember.Type.DRIVER){
|
|
||||||
// @Override
|
|
||||||
// public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
|
||||||
// return List.of();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
|
|
||||||
// SimulationMember targetMember = command.getTargetMember();
|
|
||||||
// VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
|
||||||
// if (DriveMode.RM.equals(train.getPreselectionMode())) {
|
|
||||||
// targetMember.setCommand(null);
|
|
||||||
// return null;
|
|
||||||
// } else {
|
|
||||||
// if (!train.isAtpOn()) {
|
|
||||||
// return buildDriverATPChangeOperationStep(train.getGroupNumber(), false);
|
|
||||||
// }
|
|
||||||
// targetMember.setCommand(null);
|
|
||||||
// return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
//
|
|
||||||
// /** 转CM模式 */
|
|
||||||
// Apply_CM_Mode(List.of(), SimulationMember.Type.DRIVER){
|
|
||||||
// @Override
|
|
||||||
// public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
|
||||||
// return List.of();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
|
|
||||||
// SimulationMember targetMember = command.getTargetMember();
|
|
||||||
// VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
|
||||||
// targetMember.setCommand(null);
|
|
||||||
// if (DriveMode.CM.equals(train.getPreselectionMode())) {
|
|
||||||
// return null;
|
|
||||||
// } else {
|
|
||||||
// if (!train.isAtpOn()) {
|
|
||||||
// return buildDriverATPChangeOperationStep(train.getGroupNumber(), false);
|
|
||||||
// }
|
|
||||||
// return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
//
|
|
||||||
// /** 转AM模式 */
|
|
||||||
// Apply_AM_C(List.of(), SimulationMember.Type.DRIVER){
|
|
||||||
// @Override
|
|
||||||
// public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
|
||||||
// return List.of();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
|
|
||||||
// SimulationMember targetMember = command.getTargetMember();
|
|
||||||
// VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
|
||||||
// if (DriveMode.AM.equals(train.getPreselectionMode())) {
|
|
||||||
// targetMember.setCommand(null);
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// if (!train.isAtpOn()) {
|
|
||||||
// return buildDriverATPChangeOperationStep(train.getGroupNumber(), false);
|
|
||||||
// }
|
|
||||||
// if (!train.isCMMode()) {
|
|
||||||
// return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM);
|
|
||||||
// } else {
|
|
||||||
// targetMember.setCommand(null);
|
|
||||||
// return buildDriverAtoOpenOperationStep(train.getGroupNumber());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
|
|
||||||
/** 回库 */
|
|
||||||
Inbound(List.of(), SimulationMember.Type.DRIVER) {
|
Inbound(List.of(), SimulationMember.Type.DRIVER) {
|
||||||
@Override
|
@Override
|
||||||
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
||||||
@ -615,8 +503,10 @@ public class CommandBO {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 修改预选模式 */
|
/**
|
||||||
Change_Preselection_Mode(List.of(ParamName.preselectionMode), SimulationMember.Type.DRIVER){
|
* 修改预选模式
|
||||||
|
*/
|
||||||
|
Change_Preselection_Mode(List.of(ParamName.preselectionMode), SimulationMember.Type.DRIVER) {
|
||||||
@Override
|
@Override
|
||||||
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@ -626,41 +516,22 @@ public class CommandBO {
|
|||||||
public Step execute(Simulation simulation, CommandBO command) {
|
public Step execute(Simulation simulation, CommandBO command) {
|
||||||
SimulationMember driver = command.getTargetMember();
|
SimulationMember driver = command.getTargetMember();
|
||||||
VirtualRealityTrain train = (VirtualRealityTrain) driver.getDevice();
|
VirtualRealityTrain train = (VirtualRealityTrain) driver.getDevice();
|
||||||
|
if (train.isSignalEB()) {
|
||||||
|
return getStep4ReleaseEB(train);
|
||||||
|
}
|
||||||
PreselectionMode preselectionMode =
|
PreselectionMode preselectionMode =
|
||||||
PreselectionMode.valueOf((String) command.getParams().get(ParamName.preselectionMode.name()));
|
PreselectionMode.valueOf((String) command.getParams().get(ParamName.preselectionMode.name()));
|
||||||
PreselectionMode trainMode = train.getPreselectionMode();
|
PreselectionMode trainMode = train.getPreselectionMode();
|
||||||
PreselectionMode tempMode = train.getTempPreselectionMode();
|
|
||||||
String groupNumber = train.getGroupNumber();
|
|
||||||
if (trainMode != preselectionMode) { //预选级别不对
|
if (trainMode != preselectionMode) { //预选级别不对
|
||||||
if (tempMode != preselectionMode) {
|
return getStep4ChangePreselectionMode(train, preselectionMode);
|
||||||
if (preselectionMode.isHigherThan(tempMode)) {
|
} else if (trainMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
|
||||||
return buildPreselectionModeUpOperationStep(groupNumber);
|
return getStep4OpenATO(train);
|
||||||
} else {
|
|
||||||
return buildPreselectionModeDownOperationStep(groupNumber);
|
|
||||||
}
|
|
||||||
} else if (ConfirmationMessage.Confirm_Preselection.equals(train.findFirstMessage())){
|
|
||||||
return buildConfirmOperationStep(groupNumber);
|
|
||||||
}
|
|
||||||
} else if (trainMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()){
|
|
||||||
if (!train.isAtpOn()) {
|
|
||||||
return buildDriverATPChangeOperationStep(groupNumber, false);
|
|
||||||
}
|
|
||||||
if (!train.isInTheGear(Handwheel.ATO)) {
|
|
||||||
return buildGearChangeStep(groupNumber, Handwheel.ATO);
|
|
||||||
}
|
|
||||||
if (!train.isCoasting()) {
|
|
||||||
return buildDriverForceChangeOperationStep(groupNumber, 0);
|
|
||||||
}
|
|
||||||
if (!train.isAtoOn()) {
|
|
||||||
return buildDriverAtoOpenOperationStep(groupNumber);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
driver.setCommand(null);
|
driver.setCommand(null);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
;
|
|
||||||
|
|
||||||
public enum ParamName {
|
public enum ParamName {
|
||||||
stationCode,
|
stationCode,
|
||||||
@ -724,33 +595,21 @@ public class CommandBO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建取消EB的步骤
|
* 构建缓解EB的步骤
|
||||||
* @param train
|
|
||||||
*/
|
*/
|
||||||
public Step buildReleaseEBStep(VirtualRealityTrain train) {
|
public Step getStep4ReleaseEB(VirtualRealityTrain train) {
|
||||||
if (!train.isStop()) {
|
if (!train.isInTheGear(Handwheel.MANUAL)) {
|
||||||
|
return buildGearChangeStep(train.getGroupNumber(), Handwheel.MANUAL);
|
||||||
|
}
|
||||||
|
if (!train.isStop() || !train.isLeverNotInTractionGear()) {
|
||||||
return buildDriverForceChangeOperationStep(train.getGroupNumber(), -2);
|
return buildDriverForceChangeOperationStep(train.getGroupNumber(), -2);
|
||||||
}
|
}
|
||||||
if (!train.isRMMode()) {
|
if (!train.isRMMode()) {
|
||||||
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM);
|
return getStep4ChangePreselectionMode(train, PreselectionMode.RM);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建“改变列车运行模式操作”步骤
|
|
||||||
*/
|
|
||||||
public Step buildDriverDriveModeChangeOperationStep(String groupNumber, DriveMode driveMode) {
|
|
||||||
Map<String, Object> operationParams = new HashMap<>();
|
|
||||||
operationParams.put("groupNumber", groupNumber);
|
|
||||||
operationParams.put("driveMode", driveMode);
|
|
||||||
Step step = new Step();
|
|
||||||
step.setType(Step.StepType.OPERATION);
|
|
||||||
step.setOperationType(Operation.Type.Driver_Drive_Mode_Change);
|
|
||||||
step.setOperationParams(operationParams);
|
|
||||||
return step;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建“开启ATO操作”步骤
|
* 构建“开启ATO操作”步骤
|
||||||
*/
|
*/
|
||||||
@ -884,25 +743,39 @@ public class CommandBO {
|
|||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Step getStep4ChangePreselectionMode(VirtualRealityTrain train, PreselectionMode preselectionMode) {
|
||||||
* 检查是否可以将rm升为bm并开启ATO
|
PreselectionMode trainMode = train.getPreselectionMode();
|
||||||
*/
|
PreselectionMode tempMode = train.getTempPreselectionMode();
|
||||||
public Step getStepOfRm2BmAndOpenAto(CommandBO command) {
|
String groupNumber = train.getGroupNumber();
|
||||||
List<Step> steps = command.getStepByType(Step.StepType.RM_TO_BM);
|
if (trainMode != preselectionMode) { //预选级别不对
|
||||||
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
if (tempMode != preselectionMode) {
|
||||||
Step step = steps.get(0);
|
if (preselectionMode.isHigherThan(tempMode)) {
|
||||||
if (step.isFinish() && DriveMode.CM.equals(train.getDriveMode())) { //如果步骤已经完成(指越过正常开放的信号机或站台停车)且列车为CM模式
|
return buildPreselectionModeUpOperationStep(groupNumber);
|
||||||
command.getTargetMember().setCommand(null);
|
} else {
|
||||||
return buildDriverAtoOpenOperationStep(train.getGroupNumber());
|
return buildPreselectionModeDownOperationStep(groupNumber);
|
||||||
}
|
}
|
||||||
//---越信号机升级检测(暂时改为列车级别为ITC/CBTC检测)---
|
} else if (ConfirmationMessage.Confirm_Preselection.equals(train.findFirstMessage())) {
|
||||||
if (RunLevel.ITC.equals(train.getRunLevel()) || RunLevel.CBTC.equals(train.getRunLevel())) {
|
return buildConfirmOperationStep(groupNumber);
|
||||||
step.finish();
|
|
||||||
if (!DriveMode.CM.equals(train.getDriveMode())) { //如果列车不是CM/BM/SM模式
|
|
||||||
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Step getStep4OpenATO(VirtualRealityTrain train) {
|
||||||
|
String groupNumber = train.getGroupNumber();
|
||||||
|
if (!train.isAtpOn()) {
|
||||||
|
return buildDriverATPChangeOperationStep(groupNumber, false);
|
||||||
|
}
|
||||||
|
if (!train.isInTheGear(Handwheel.ATO)) {
|
||||||
|
return buildGearChangeStep(groupNumber, Handwheel.ATO);
|
||||||
|
}
|
||||||
|
if (!train.isLeverInCoastingGear()) {
|
||||||
|
return buildDriverForceChangeOperationStep(groupNumber, 0);
|
||||||
|
}
|
||||||
|
if (!train.isAtoOn()) {
|
||||||
|
return buildDriverAtoOpenOperationStep(groupNumber);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,11 +421,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
*/
|
*/
|
||||||
private boolean needDepartureCommand;
|
private boolean needDepartureCommand;
|
||||||
|
|
||||||
/**
|
|
||||||
* 操纵杆
|
|
||||||
*/
|
|
||||||
private float controlLeaver;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 有定位
|
* 有定位
|
||||||
*/
|
*/
|
||||||
@ -575,7 +570,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
this.runType = null;
|
this.runType = null;
|
||||||
this.orderStop = false;
|
this.orderStop = false;
|
||||||
this.needDepartureCommand = false;
|
this.needDepartureCommand = false;
|
||||||
this.controlLeaver = 0;
|
|
||||||
this.positioned = true;
|
this.positioned = true;
|
||||||
this.runningTime = 0;
|
this.runningTime = 0;
|
||||||
this.fault = null;
|
this.fault = null;
|
||||||
@ -1113,9 +1107,14 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
return getAtoSpeed() * 3.6 < 20;
|
return getAtoSpeed() * 3.6 < 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 是否惰行 */
|
/** 操纵杆是否在惰行位 */
|
||||||
public boolean isCoasting() {
|
public boolean isLeverInCoastingGear() {
|
||||||
return controlLeaver == 0;
|
return leverPosition == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 是否不在牵引位 */
|
||||||
|
public boolean isLeverNotInTractionGear() {
|
||||||
|
return leverPosition <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1429,7 +1428,10 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
* 是否比该模式级别更高
|
* 是否比该模式级别更高
|
||||||
*/
|
*/
|
||||||
public boolean isHigherThan(PreselectionMode mode) {
|
public boolean isHigherThan(PreselectionMode mode) {
|
||||||
return this.runLevel.isHigherThan(mode.runLevel) && this.driveMode.isHigherThan(mode.driveMode);
|
if (this.runLevel.isHigherThan(mode.runLevel)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return this.driveMode.isHigherThan(mode.driveMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class ATPLogicLoop {
|
|||||||
|
|
||||||
/* 缓解EB检查 */
|
/* 缓解EB检查 */
|
||||||
if (train.isEB()) {
|
if (train.isEB()) {
|
||||||
if (train.isRMMode() && train.getControlLeaver() <= 0) { //停车、RM模式、操纵杆非牵引位
|
if (train.isRMMode() && train.isLeverNotInTractionGear()) { //停车、RM模式、操纵杆非牵引位
|
||||||
atpService.cancelSignalEB(train);
|
atpService.cancelSignalEB(train);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ public class ATPService {
|
|||||||
return false;
|
return false;
|
||||||
if (!VirtualRealityTrain.Handwheel.ATO.equals(train.getGear())) //工况手轮不在ATO位
|
if (!VirtualRealityTrain.Handwheel.ATO.equals(train.getGear())) //工况手轮不在ATO位
|
||||||
return false;
|
return false;
|
||||||
if (train.getControlLeaver() != 0) //操纵杆不在惰行位
|
if (!train.isLeverInCoastingGear()) //操纵杆不在惰行位
|
||||||
return false;
|
return false;
|
||||||
if (train.getAtoSpeed() <= 0) //列车无推荐速度
|
if (train.getAtoSpeed() <= 0) //列车无推荐速度
|
||||||
return false;
|
return false;
|
||||||
|
@ -204,15 +204,9 @@ public class RobotLogicLoop {
|
|||||||
break;
|
break;
|
||||||
case CM:
|
case CM:
|
||||||
MaService.Ma ma = train.getMa2();
|
MaService.Ma ma = train.getMa2();
|
||||||
speedCurve = SpeedCurve.calculateAtoStopCurveAndUpdate(train, ma, targetPosition);
|
if (ma != null) {
|
||||||
// Float recommendedSpeedMax = Stream.of(train.getAtpSpeedMax(), train.getSpeedLimit() * 0.9f, train.getAtoSpeedMax())
|
speedCurve = ma.getAtoStopCurve();
|
||||||
// .min(Comparator.comparingDouble(Float::doubleValue)).get();
|
}
|
||||||
// Float remainDistance = ATOService.calculateDistanceOfMa(headPosition, right, train.getMa());
|
|
||||||
// if (remainDistance == null)
|
|
||||||
// remainDistance = 0f;
|
|
||||||
// distance = Math.min(distance, remainDistance);
|
|
||||||
// speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right,
|
|
||||||
// distance, speed, recommendedSpeedMax);
|
|
||||||
break;
|
break;
|
||||||
case RM:
|
case RM:
|
||||||
speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right,
|
speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right,
|
||||||
@ -228,10 +222,8 @@ public class RobotLogicLoop {
|
|||||||
train.setTargetDistance(distance);
|
train.setTargetDistance(distance);
|
||||||
if (speedCurve != null) {
|
if (speedCurve != null) {
|
||||||
float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance());
|
float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance());
|
||||||
// train.setAtoSpeed(atoSpeed);
|
|
||||||
atoService.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance(), atoSpeed);
|
atoService.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance(), atoSpeed);
|
||||||
}
|
}
|
||||||
// doControlBySpeedCurve(simulation, train, speedCurve, speedCurve.getTotalDistance());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user