【切换预选模式修改、增加开启ATO操作、大铁列车托管修改行驶至前方站与进路闭塞行车】
This commit is contained in:
parent
c4ee87eccc
commit
4e242417aa
|
@ -923,6 +923,10 @@ public class Operation {
|
|||
* 转NRM模式
|
||||
*/
|
||||
Apply_NRM(new Label[]{Label.OTHER},true),
|
||||
/**
|
||||
* 切换ATO操作
|
||||
*/
|
||||
Try_Open_Ato(new Label[]{Label.OTHER}, true),
|
||||
//--------------------------- 方向杆 ---------------------------
|
||||
/**
|
||||
* 方向转换
|
||||
|
|
|
@ -217,4 +217,12 @@ public class DriverOperateHandler {
|
|||
public void applyNRM(Simulation simulation, String groupNumber) {
|
||||
ATPService.applyNRM(simulation, groupNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作打开 ATO
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Try_Open_Ato)
|
||||
public void tryOpenAto(Simulation simulation, String groupNumber) {
|
||||
ATPService.openAto(simulation, groupNumber);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -481,22 +481,23 @@ public class AtsTrainService {
|
|||
param.setThroughSignal(signal);
|
||||
param.setThroughSignalAspect(signal.getGuideAspect());
|
||||
} else if (param.isDriverNextStand()){ // 行驶至前方车站
|
||||
// 列车车头所在区段
|
||||
Section headSection = train.getHeadPosition().getSection();
|
||||
// 停车目的区段
|
||||
if (section.isStandTrack()) {
|
||||
targetPosition = new SectionPosition(headSection, headSection.getStopPointByDirection(train.isRight()));
|
||||
targetPosition = new SectionPosition(section, section.getStopPointByDirection(train.isRight()));
|
||||
} else {
|
||||
targetPosition = train.calculateNextStandStopPosition();
|
||||
if (targetPosition == null && train.getTarget() != null) {
|
||||
targetPosition = new SectionPosition(train.getTarget(), train.getTarget().getStopPointByDirection(train.isRight()));
|
||||
}
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(targetPosition, train.debugStr() + "找不到下一个停车点");
|
||||
param.setThroughSignal(section.getSignalOf(right));
|
||||
}
|
||||
atpService.changePreselectionMode(train, VirtualRealityTrain.PreselectionMode.RM);
|
||||
} else if (param.isRouteBlockDriver()) { // 进路闭塞行车
|
||||
if (!train.isAMMode()) {
|
||||
atpService.changePreselectionMode(train, VirtualRealityTrain.PreselectionMode.AM_C);
|
||||
Signal signal = section.getSignalOf(right);
|
||||
Route route = (signal != null) ? signal.getLockedRoute() : section.getRoute();
|
||||
if (route != null) {
|
||||
targetPosition = new SectionPosition(route.getLastRouteSection(), route.getLastRouteSection().getStopPointByDirection(train.isRight()));
|
||||
param.setThroughSignal(signal);
|
||||
}
|
||||
}else {
|
||||
param.setThroughSignal(null);
|
||||
|
|
|
@ -63,33 +63,7 @@ public class ATPLogicLoop {
|
|||
// System.out.println(String.format("------------ATP防护、检查、消息构建发送逻辑耗时: %s ms", (end-start)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新列车运行级别
|
||||
*/
|
||||
private void updateRunLevel(Simulation simulation, VirtualRealityTrain train, VirtualRealityTrain.PreselectionMode preselectionMode) {
|
||||
//如果当前级别高于预选,降至IL
|
||||
if (!preselectionMode.isMatchTheRunLevel(train.getRunLevel())) {
|
||||
atpService.updateRunLevel(train, RunLevel.IL, preselectionMode);
|
||||
}
|
||||
|
||||
RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
|
||||
//更新移动授权丢失时长
|
||||
train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
//判断并控制运行级别
|
||||
if (!train.isPositioned()) { //列车定位丢失(降级)
|
||||
if (train.isITC() || train.isCBTC()) { //并且是ITC/CBTC级别
|
||||
atpService.updateRunLevel(train, RunLevel.IL, preselectionMode);
|
||||
atpService.triggerSignalEB(train);
|
||||
}
|
||||
} else { //列车有定位
|
||||
if (train.isCBTC() && train.isCbtcMaMiss()) { //CBTC列车的移动授权丢失
|
||||
atpService.updateRunLevel(train, RunLevel.IL, preselectionMode);
|
||||
atpService.triggerSignalEB(train);
|
||||
} else if (!train.isCBTC() && !train.isCbtcMaMiss() && defaultRunLevel.equals(RunLevel.CBTC)) {
|
||||
atpService.updateRunLevel(train, RunLevel.CBTC, preselectionMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
|
||||
// MaService.Ma ma2 = train.getMa2();
|
||||
|
@ -124,7 +98,7 @@ public class ATPLogicLoop {
|
|||
}
|
||||
|
||||
private void onboardLogicRun2(Simulation simulation, VirtualRealityTrain train) {
|
||||
this.handlePreselectionMode(simulation, train);
|
||||
atpService.handlePreselectionMode(simulation, train);
|
||||
this.calculateSpeedCurve(simulation, train);
|
||||
this.closeATOIfStatusIsIncorrect(train);
|
||||
train.setAtoCanOpen(atpService.canOpenATO(train));
|
||||
|
@ -271,31 +245,6 @@ public class ATPLogicLoop {
|
|||
|
||||
}
|
||||
|
||||
private void handlePreselectionMode(Simulation simulation, VirtualRealityTrain train) {
|
||||
VirtualRealityTrain.PreselectionMode preselectionMode = train.getPreselectionMode();
|
||||
MapConfig config = simulation.getRepository().getConfig();
|
||||
switch (preselectionMode) {
|
||||
case AM_C:
|
||||
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
|
||||
train.setCommunication(true);
|
||||
break;
|
||||
case SM_C:
|
||||
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
|
||||
train.setCommunication(true);
|
||||
atpService.closeATO(train);
|
||||
break;
|
||||
case AM_I:
|
||||
train.setCommunication(false);
|
||||
break;
|
||||
case SM_I:
|
||||
case RM:
|
||||
train.setCommunication(false);
|
||||
atpService.closeATO(train);
|
||||
break;
|
||||
}
|
||||
updateRunLevel(simulation, train, preselectionMode);
|
||||
}
|
||||
|
||||
private void updateRunningTime(VirtualRealityTrain train) {
|
||||
if (train.isParkingAt()) {
|
||||
train.setRunningTime(0);
|
||||
|
|
|
@ -11,6 +11,7 @@ import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
|||
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
|
||||
|
@ -566,15 +567,36 @@ public class ATPService {
|
|||
*/
|
||||
public void changePreselectionMode(Simulation simulation, String groupNumber, VirtualRealityTrain.PreselectionMode preselectionMode) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
// 检验条件
|
||||
// operationVail(simulation,train);
|
||||
if (preselectionMode == train.getPreselectionMode()) {
|
||||
return;
|
||||
}
|
||||
if (!train.isAtpOn()) {
|
||||
this.openAtp(train);
|
||||
}
|
||||
if (train.isSignalEB()) {
|
||||
this.releaseEB(train);
|
||||
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.MANUAL)) {
|
||||
changeGear(train, VirtualRealityTrain.Handwheel.MANUAL);
|
||||
}
|
||||
if (!train.isStop() || !train.isLeverNotInTractionGear()) {
|
||||
changeTrainForce(train, -2F); // 改变列车的牵引/
|
||||
}
|
||||
if (!train.isRMMode()) {
|
||||
train.setTempPreselectionMode(PreselectionMode.RM);
|
||||
train.setPreselectionMode(PreselectionMode.RM);
|
||||
}
|
||||
}
|
||||
changePreselectionMode(train, preselectionMode);
|
||||
// 对预选模式条件卡控
|
||||
if (preselectionMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
|
||||
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.ATO)) {
|
||||
changeGear(train, VirtualRealityTrain.Handwheel.ATO);
|
||||
}
|
||||
if (!train.isLeverInCoastingGear()) {
|
||||
changeTrainForce(train, 0f); // 改变列车的牵引/
|
||||
}
|
||||
}
|
||||
train.setTempPreselectionMode(preselectionMode);
|
||||
train.setPreselectionMode(preselectionMode);
|
||||
handlePreselectionMode(simulation, train);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -622,56 +644,25 @@ public class ATPService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 修改预选模式
|
||||
*
|
||||
* @param train 列车
|
||||
* @param preselectionMode 预选模式
|
||||
* 打开ato
|
||||
*/
|
||||
public void changePreselectionMode(VirtualRealityTrain train, PreselectionMode preselectionMode) {
|
||||
boolean loop = true;
|
||||
int loopTime = 0;
|
||||
while (loop) {
|
||||
if (train.getPreselectionMode() != preselectionMode) { //预选级别不对
|
||||
if (train.getTempPreselectionMode() != preselectionMode) {
|
||||
if (preselectionMode.isHigherThan(train.getTempPreselectionMode())) {
|
||||
this.preselectionModeUp(train);
|
||||
} else {
|
||||
this.preselectionModeDown(train);
|
||||
}
|
||||
} else {
|
||||
this.confirmMessage(train);
|
||||
}
|
||||
} else if (train.getPreselectionMode().isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
|
||||
train.getRobotDriveParam().setRun(false); // 关闭机器人自动驾驶
|
||||
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.ATO)) {
|
||||
log.info(train.isInTheGear(VirtualRealityTrain.Handwheel.ATO) + "");
|
||||
this.changeGear(train, VirtualRealityTrain.Handwheel.ATO);
|
||||
}
|
||||
if (!train.isLeverInCoastingGear()) {
|
||||
this.changeTrainForce(train, 0F); // 改变列车的牵引
|
||||
}
|
||||
if (!train.isAtoOn()) {
|
||||
if (!canOpenATO(train)) { // 如果列车一直不能开启ATO则直接中断
|
||||
loop = loopTime ++ < 5;
|
||||
} else {
|
||||
this.openATO(train);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
loop = false;
|
||||
}
|
||||
public void openAto(Simulation simulation, String groupNumber) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
if (train.isAtoOn()) { //ATO已经开启
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseEB(VirtualRealityTrain train) {
|
||||
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.MANUAL)) {
|
||||
changeGear(train, VirtualRealityTrain.Handwheel.MANUAL);
|
||||
if (!train.isAtpOn()) { // 列车ATP未启用
|
||||
this.openAtp(train);
|
||||
}
|
||||
if (!train.isStop() || !train.isLeverNotInTractionGear()) {
|
||||
changeTrainForce(train, -2F); // 改变列车的牵引/
|
||||
if (!VirtualRealityTrain.Handwheel.ATO.equals(train.getGear())) { //工况手轮不在ATO位
|
||||
changeGear(train, VirtualRealityTrain.Handwheel.ATO);
|
||||
}
|
||||
if (!train.isRMMode()) {
|
||||
changePreselectionMode(train, PreselectionMode.RM);
|
||||
if (!train.isInAMPreselectionMode()) { //不在AM-预选模式
|
||||
changePreselectionMode(simulation, groupNumber, PreselectionMode.AM_C);
|
||||
}
|
||||
if (!train.isAtoOn()) {
|
||||
train.setAtoOn(true);
|
||||
train.setDriveMode(DriveMode.AM);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -682,4 +673,62 @@ public class ATPService {
|
|||
.anyMatch(SimulationMember::isRobot);
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotTrue(!driverRobot,"成员由用户扮演,操作不执行");
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理预处理模式
|
||||
* @param simulation 仿真
|
||||
* @param train 列车
|
||||
*/
|
||||
public void handlePreselectionMode(Simulation simulation, VirtualRealityTrain train) {
|
||||
VirtualRealityTrain.PreselectionMode preselectionMode = train.getPreselectionMode();
|
||||
MapConfig config = simulation.getRepository().getConfig();
|
||||
switch (preselectionMode) {
|
||||
case AM_C:
|
||||
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
|
||||
train.setCommunication(true);
|
||||
break;
|
||||
case SM_C:
|
||||
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC))
|
||||
train.setCommunication(true);
|
||||
closeATO(train);
|
||||
break;
|
||||
case AM_I:
|
||||
train.setCommunication(false);
|
||||
break;
|
||||
case SM_I:
|
||||
case RM:
|
||||
train.setCommunication(false);
|
||||
closeATO(train);
|
||||
break;
|
||||
}
|
||||
updateRunLevel(simulation, train, preselectionMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新列车运行级别
|
||||
*/
|
||||
private void updateRunLevel(Simulation simulation, VirtualRealityTrain train, VirtualRealityTrain.PreselectionMode preselectionMode) {
|
||||
//如果当前级别高于预选,降至IL
|
||||
if (!preselectionMode.isMatchTheRunLevel(train.getRunLevel())) {
|
||||
updateRunLevel(train, RunLevel.IL, preselectionMode);
|
||||
}
|
||||
|
||||
RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
|
||||
//更新移动授权丢失时长
|
||||
train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
//判断并控制运行级别
|
||||
if (!train.isPositioned()) { //列车定位丢失(降级)
|
||||
if (train.isITC() || train.isCBTC()) { //并且是ITC/CBTC级别
|
||||
updateRunLevel(train, RunLevel.IL, preselectionMode);
|
||||
triggerSignalEB(train);
|
||||
}
|
||||
} else { //列车有定位
|
||||
if (train.isCBTC() && train.isCbtcMaMiss()) { //CBTC列车的移动授权丢失
|
||||
updateRunLevel(train, RunLevel.IL, preselectionMode);
|
||||
triggerSignalEB(train);
|
||||
} else if (!train.isCBTC() && !train.isCbtcMaMiss() && defaultRunLevel.equals(RunLevel.CBTC)) {
|
||||
updateRunLevel(train, RunLevel.CBTC, preselectionMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue