修改机器人开启ATO的逻辑;修改[延续保护太早锁闭在错误位置导致无法办理]的bug

This commit is contained in:
joylink_zhangsai 2023-11-15 13:21:36 +08:00
parent f1da71f236
commit 25c31fcefb
3 changed files with 61 additions and 60 deletions

View File

@ -102,9 +102,9 @@ public class CiRouteService {
}
// 故障占用
for (int i = 0; i < 3; i++) {
if (section.getParent() == null || section.isAxleCounter()) {
break;
}
if (section.getParent() == null || section.isAxleCounter()) {
break;
}
section = section.getParent();
}
// if (Section.AxleFault.FAULT.equals(section.getFault())) {
@ -720,7 +720,6 @@ public class CiRouteService {
if (!switchElement.getASwitch().ciUse(switchElement.isNormal())) {
return;
}
switchElement.getASwitch().overlapLock();
}
// 延续保护位置转动
boolean onPos = this.switchControlService.ensureSwitchPosCurrent(simulation,
@ -741,6 +740,7 @@ public class CiRouteService {
private void checkAndLockOverlap(Simulation simulation, RouteOverlap overlap) {
SectionPath sectionPath = overlap.selectPath();
boolean right = overlap.isRight();
//区段锁闭
List<Section> logicList = sectionPath.getLogicList();
if (!CollectionUtils.isEmpty(logicList)) {
for (Section section : logicList) {
@ -757,6 +757,10 @@ public class CiRouteService {
}
}
}
//道岔锁闭
for (SwitchElement switchElement : sectionPath.getSwitchList()) {
switchElement.getASwitch().overlapLock();
}
}
/**

View File

@ -380,35 +380,30 @@ public class ATPService {
* 可以开启ATO
*/
public boolean canOpenATO(VirtualRealityTrain train) {
if (train.isAtoOn()) //ATO已经开启
{
return false;
}
if (!train.isInAMPreselectionMode()) //不在AM-预选模式
{
return false;
}
if (!VirtualRealityTrain.Handwheel.ATO.equals(train.getGear())) //工况手轮不在ATO位
{
return false;
}
// if (!train.isLeverInCoastingGear()) //操纵杆不在惰行位
// return false;
// if (train.getAtoSpeed() <= 0) //列车无推荐速度
// return false;
if (!train.isITC() && !train.isCBTC()) //非ITCCTC运行级别
{
return false;
}
if (!train.isAtpOn()) //列车ATP未启用
{
return false;
}
// if (train.isEB())
// return false;
// if (train.isITC() && !train.isReleased()
// && train.containsMessage(VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed) )
// return false;
return onlyNeedAtoGearForOpenAto(train) &&
VirtualRealityTrain.Handwheel.ATO.equals(train.getGear());
}
/**
* 只需要列车在ATO档位即可开启ATO
*/
public boolean onlyNeedAtoGearForOpenAto(VirtualRealityTrain train) {
if (train.isAtoOn()) //ATO已经开启
{
return false;
}
if (!train.isInAMPreselectionMode()) //不在AM-预选模式
{
return false;
}
if (!train.isITC() && !train.isCBTC()) //非ITCCTC运行级别
{
return false;
}
if (!train.isAtpOn()) //列车ATP未启用
{
return false;
}
return true;
}
@ -476,9 +471,9 @@ public class ATPService {
case CBTC:
case ITC:
MaService.Ma ma = train.getMa2();
if (ma == null) {
return;
}
if (ma == null) {
return;
}
SpeedCurve ebTriggerCurve = ma.getEbTriggerCurve();
float ebTriggerRemain = ma.calculateDistanceOfEbTriggerEnd();
ma.setEbTriggerCurve(ebTriggerCurve);
@ -507,14 +502,14 @@ public class ATPService {
private void updateDriveMode(VirtualRealityTrain train, DriveMode driveMode,
PreselectionMode preselectionMode) {
if (driveMode.equals(train.getDriveMode())) {
return;
}
if (driveMode.equals(train.getDriveMode())) {
return;
}
if (preselectionMode.isNotLowerThanTheDriveMode(driveMode)) {
train.setDriveMode(driveMode);
if (!train.isAMMode()) {
closeATO(train);
}
if (!train.isAMMode()) {
closeATO(train);
}
}
}
@ -696,14 +691,14 @@ public class ATPService {
MapConfig config = simulation.getRepository().getConfig();
switch (preselectionMode) {
case AM_C:
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC)) {
train.setCommunication(true);
}
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);
}
if (!train.isCBTC() && config.getRunMode().isNotLowerThan(RunLevel.CBTC)) {
train.setCommunication(true);
}
closeATO(train);
break;
case AM_I:

View File

@ -12,7 +12,6 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.command.CommandBO;
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
@ -109,9 +108,9 @@ public class SimulationRobotService {
usePsl2ControlPsd(simulation, train, false);
}
break;
case START:
atpService.openATO(train);
break;
// case START: 交给统一校验及开启ATO的逻辑{robotOpenATOAfterCheck}
// atpService.openATO(train);
// break;
}
}
if (train.isStop() && train.isITC() && train.isAtoOn()) {
@ -177,7 +176,7 @@ public class SimulationRobotService {
if (train.isTakeOver() || !repository.isVrTrainOnline(train.getGroupNumber())) { //如果列车被接管或不在线
continue;
}
//判断是否需要转换手轮档位到ATO
//校验后开启ATO
robotOpenATOAfterCheck(train);
//准备发车
robotReadyForDeparture(simulation, train);
@ -206,7 +205,7 @@ public class SimulationRobotService {
} else {
robotDrive(simulation, driver, train, train.getRobotTargetPosition());
}
} else if (train.isCMMode()) { //CM
} else if (train.isCMMode() && !atpService.canOpenATO(train)) { //CM且无法开启ATO
ensureTrainInTheGear(train, VirtualRealityTrain.Handwheel.MANUAL);
SpeedCurve speedCurve = train.getMa2().getAtoStopCurve();
atoService.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance(),
@ -216,16 +215,19 @@ public class SimulationRobotService {
}
/**
* 在检查通过后开启ATO
* 在检查通过后开启ATO此逻辑用于从非AM模式向AM模式升级
*/
private void robotOpenATOAfterCheck(VirtualRealityTrain train) {
//停站时的情况可能比较特殊保险起见停站时不做处理
if (train.isParkingAt()) {
if (train.isAtoOn()) {
return;
}
//列车的预选模式支持到达AM驾驶模式并且列车的ATO推荐速度大于0
if (train.getPreselectionMode().isNotLowerThanTheDriveMode(DriveMode.AM)
&& train.getAtoSpeed() > 0) {
//列车停站会自动关闭ATO在准备发车前不应开启
if (train.isParkingAt()
&& train.getStandParkedTrainActivity() != StandParkedTrainActivity.START) {
return;
}
//列车只差档位即可开启ATO则转档位开ATO
if (atpService.onlyNeedAtoGearForOpenAto(train)) {
ensureTrainInTheGear(train, VirtualRealityTrain.Handwheel.ATO);
atpService.openATO(train);
}