diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index d8726879a..651d60853 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -402,8 +402,8 @@ public class Operation { Driver_ATO_Open, /** 改变ATP状态 */ Driver_ATP_Change, - /** 改变列车运行模式 */ - Driver_Drive_Mode_Change, +// /** 改变列车运行模式 */ +// Driver_Drive_Mode_Change, /** 换端 */ Driver_Change_Head, /** 列车车门开关 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/DriverOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/DriverOperateHandler.java index 4647bec92..70d49926b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/DriverOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/DriverOperateHandler.java @@ -34,7 +34,7 @@ public class DriverOperateHandler { // if (train.isSignalEB() && percent == -2) // ATPService.cancelSignalEB(train); if ((percent <= 1 && percent >= -1) || percent == -2) { - train.setControlLeaver(percent); + train.setLeverPosition(percent); } if (train.isEB()) { return; @@ -53,12 +53,8 @@ public class DriverOperateHandler { train.leaverUpdateTBForce(0, 350); } else { 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) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java index 4cec179ab..1e2b06dc6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java @@ -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.Simulation; 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.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Signal; @@ -154,7 +153,6 @@ public class CommandBO { List stepList = new ArrayList<>(); stepList.add(buildDriverForceChangeOperationStep(train.getGroupNumber(), 0)); - stepList.add(buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM)); if (section.isStandTrack()) { //如果列车的车头所在区段是站台轨 SectionPosition standStopPosition = new SectionPosition(section, section.getStopPointByDirection(right)); if (train.isStopAtThePosition(standStopPosition)) { //列车已经停在站台停车点 @@ -177,7 +175,6 @@ public class CommandBO { train.debugStr() + "找不到下一个停车点"); stepList.add(buildDriveStep(nextStopPosition)); } - stepList.add(buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM)); stepList.add(buildRmToBmStep()); return stepList; @@ -186,16 +183,18 @@ public class CommandBO { @Override public Step execute(Simulation simulation, CommandBO command) { VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice(); - //如果列车没停到目标位置,先想办法开过去--- List steps = command.getStepByType(Step.StepType.DRIVE); Step driveStep = steps.get(0); if (!train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车没停到目标位置 + if (!train.isInTheGear(Handwheel.MANUAL)) { + return buildGearChangeStep(train.getGroupNumber(), Handwheel.MANUAL); + } if (!train.isStop()) return buildDriverForceChangeOperationStep(train.getGroupNumber(), -1); if (!DriveMode.RM.equals(train.getDriveMode()) && !train.isNRMMode()) - return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM); + return getStep4ChangePreselectionMode(train, PreselectionMode.RM); if (train.isEB()) - return buildReleaseEBStep(train); + return getStep4ReleaseEB(train); return driveStep; } else { //如果列车已经停到目标位置 // if (!DriveMode.AM.equals(train.getDriveMode())) @@ -212,26 +211,16 @@ public class CommandBO { Route_Block_Drive(Collections.emptyList(), SimulationMember.Type.DRIVER) { @Override public List buildStepList(Simulation simulation, SimulationMember targetMember, Map params) { - List stepList = new ArrayList<>(); - 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; + return Collections.emptyList(); } @Override public Step execute(Simulation simulation, CommandBO command) { VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice(); - if (!DriveMode.CM.equals(train.getDriveMode()) && !DriveMode.AM.equals(train.getDriveMode())) { //如果列车不处于CM/AM运行级别 - return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM); - } - if (!train.isAtoOn()) { //列车ATO没开 - return buildDriverAtoOpenOperationStep(train.getGroupNumber()); - } - if (RunLevel.CBTC.equals(train.getRunLevel())) { //列车的运行级别为CBTC时,结束指令 + if (train.isAMMode()) { command.getTargetMember().setCommand(null); + } else { + getStep4ChangePreselectionMode(train, PreselectionMode.AM_C); } return null; } @@ -299,23 +288,12 @@ public class CommandBO { if (stopCorrectly) { //如果列车已经停到目标位置 driveStep.finish(); 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 { if (!DriveMode.RM.equals(train.getDriveMode()) && !train.isNRMMode()) { - return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM); + return getStep4ChangePreselectionMode(train, PreselectionMode.RM); } if (train.isSignalEB()) { - return buildReleaseEBStep(train); + return getStep4ReleaseEB(train); } return driveStep; } @@ -337,7 +315,6 @@ public class CommandBO { VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice(); stepList.add(buildDriveStep(train.calculateStepPosition4CrossTheGuideSignal())); stepList.add(buildCrossSignalStep(train.getHeadPosition().getSection().getSignalOf(train.isRight()))); - stepList.add(buildRmToBmStep()); return stepList; } @@ -345,29 +322,30 @@ public class CommandBO { @Override public Step execute(Simulation simulation, CommandBO command) { VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice(); - Step crossSignalStep = command.getStepByType(Step.StepType.CROSS_SIGNAL).get(0); - Signal signal = crossSignalStep.getCrossSignal(); - SectionPosition signalPosition = new SectionPosition(signal.getSection(), signal.getOffset()); - if (train.getHeadPosition().isAheadOf(signalPosition, train.isRight())) { //如果已经越过了信号机 - Step step = getStepOfRm2BmAndOpenAto(command); - if (step != null) { - return step; - } +// Step crossSignalStep = command.getStepByType(Step.StepType.CROSS_SIGNAL).get(0); +// Signal signal = crossSignalStep.getCrossSignal(); +// SectionPosition signalPosition = new SectionPosition(signal.getSection(), signal.getOffset()); +// if (train.getHeadPosition().isAheadOf(signalPosition, train.isRight())) { //如果已经越过了信号机 +// if (train.isAMMode()) { +// command.getTargetMember().setCommand(null); +// } 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())) { - PreselectionMode tempMode = train.getTempPreselectionMode(); - if (!PreselectionMode.RM.equals(tempMode)) { - - } + if (!train.isInTheGear(Handwheel.MANUAL)) { //转手轮 + return buildGearChangeStep(train.getGroupNumber(), Handwheel.MANUAL); } List steps = command.getStepByType(Step.StepType.DRIVE); Step driveStep = steps.get(0); if (train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车已经停到目标位置 command.getTargetMember().setCommand(null); - return null; } else { return driveStep; } + return null; } }, @@ -393,7 +371,6 @@ public class CommandBO { } else if (!train.getDoorByDirection(true).isCloseAndLock()) { //列车右门没关 stepList.add(buildDoorOnOffOperationStep(train.getGroupNumber(), true, false)); } else { - // 根据站台方向位置和列车方向,同步开屏蔽门、车门 boolean doorIsRight; for (Stand stand : standList) { if (stand.isInside() && stand.isRight()) { // 内测右站台,开1门 @@ -474,7 +451,9 @@ public class CommandBO { } }, - /** 驾驶至 */ + /** + * 驾驶至 + */ Drive_To(List.of(ParamName.sectionCode), SimulationMember.Type.DRIVER) { @Override public List buildStepList(Simulation simulation, SimulationMember targetMember, Map params) { @@ -497,100 +476,9 @@ public class CommandBO { } }, -// /** 转URM模式 */ -// Apply_URM_Mode(List.of(), SimulationMember.Type.DRIVER) { -// @Override -// public List buildStepList(Simulation simulation, SimulationMember targetMember, Map 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 buildStepList(Simulation simulation, SimulationMember targetMember, Map 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 buildStepList(Simulation simulation, SimulationMember targetMember, Map 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 buildStepList(Simulation simulation, SimulationMember targetMember, Map 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) { @Override public List buildStepList(Simulation simulation, SimulationMember targetMember, Map 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 public List buildStepList(Simulation simulation, SimulationMember targetMember, Map params) { return Collections.emptyList(); @@ -626,41 +516,22 @@ public class CommandBO { public Step execute(Simulation simulation, CommandBO command) { SimulationMember driver = command.getTargetMember(); VirtualRealityTrain train = (VirtualRealityTrain) driver.getDevice(); + if (train.isSignalEB()) { + return getStep4ReleaseEB(train); + } PreselectionMode preselectionMode = PreselectionMode.valueOf((String) command.getParams().get(ParamName.preselectionMode.name())); PreselectionMode trainMode = train.getPreselectionMode(); - PreselectionMode tempMode = train.getTempPreselectionMode(); - String groupNumber = train.getGroupNumber(); if (trainMode != preselectionMode) { //预选级别不对 - if (tempMode != preselectionMode) { - if (preselectionMode.isHigherThan(tempMode)) { - return buildPreselectionModeUpOperationStep(groupNumber); - } 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); - } + return getStep4ChangePreselectionMode(train, preselectionMode); + } else if (trainMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) { + return getStep4OpenATO(train); } else { driver.setCommand(null); } return null; } - } - ; + }; public enum ParamName { stationCode, @@ -724,33 +595,21 @@ public class CommandBO { } /** - * 构建取消EB的步骤 - * @param train + * 构建缓解EB的步骤 */ - public Step buildReleaseEBStep(VirtualRealityTrain train) { - if (!train.isStop()) { + public Step getStep4ReleaseEB(VirtualRealityTrain train) { + if (!train.isInTheGear(Handwheel.MANUAL)) { + return buildGearChangeStep(train.getGroupNumber(), Handwheel.MANUAL); + } + if (!train.isStop() || !train.isLeverNotInTractionGear()) { return buildDriverForceChangeOperationStep(train.getGroupNumber(), -2); } if (!train.isRMMode()) { - return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM); + return getStep4ChangePreselectionMode(train, PreselectionMode.RM); } return null; } - /** - * 构建“改变列车运行模式操作”步骤 - */ - public Step buildDriverDriveModeChangeOperationStep(String groupNumber, DriveMode driveMode) { - Map 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操作”步骤 */ @@ -884,25 +743,39 @@ public class CommandBO { return step; } - /** - * 检查是否可以将rm升为bm并开启ATO - */ - public Step getStepOfRm2BmAndOpenAto(CommandBO command) { - List steps = command.getStepByType(Step.StepType.RM_TO_BM); - VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice(); - Step step = steps.get(0); - if (step.isFinish() && DriveMode.CM.equals(train.getDriveMode())) { //如果步骤已经完成(指越过正常开放的信号机或站台停车)且列车为CM模式 - command.getTargetMember().setCommand(null); - return buildDriverAtoOpenOperationStep(train.getGroupNumber()); - } - //---越信号机升级检测(暂时改为列车级别为ITC/CBTC检测)--- - if (RunLevel.ITC.equals(train.getRunLevel()) || RunLevel.CBTC.equals(train.getRunLevel())) { - step.finish(); - if (!DriveMode.CM.equals(train.getDriveMode())) { //如果列车不是CM/BM/SM模式 - return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM); + public Step getStep4ChangePreselectionMode(VirtualRealityTrain train, PreselectionMode preselectionMode) { + PreselectionMode trainMode = train.getPreselectionMode(); + PreselectionMode tempMode = train.getTempPreselectionMode(); + String groupNumber = train.getGroupNumber(); + if (trainMode != preselectionMode) { //预选级别不对 + if (tempMode != preselectionMode) { + if (preselectionMode.isHigherThan(tempMode)) { + return buildPreselectionModeUpOperationStep(groupNumber); + } else { + return buildPreselectionModeDownOperationStep(groupNumber); + } + } else if (ConfirmationMessage.Confirm_Preselection.equals(train.findFirstMessage())) { + return buildConfirmOperationStep(groupNumber); } } 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; + } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java index 0c6624410..536b01ed6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java @@ -421,11 +421,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice { */ private boolean needDepartureCommand; - /** - * 操纵杆 - */ - private float controlLeaver; - /** * 有定位 */ @@ -575,7 +570,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice { this.runType = null; this.orderStop = false; this.needDepartureCommand = false; - this.controlLeaver = 0; this.positioned = true; this.runningTime = 0; this.fault = null; @@ -1113,9 +1107,14 @@ public class VirtualRealityTrain extends VirtualRealityDevice { return getAtoSpeed() * 3.6 < 20; } - /** 是否惰行 */ - public boolean isCoasting() { - return controlLeaver == 0; + /** 操纵杆是否在惰行位 */ + public boolean isLeverInCoastingGear() { + return leverPosition == 0; + } + + /** 是否不在牵引位 */ + public boolean isLeverNotInTractionGear() { + return leverPosition <= 0; } /** @@ -1429,7 +1428,10 @@ public class VirtualRealityTrain extends VirtualRealityDevice { * 是否比该模式级别更高 */ 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); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java index 6e1051248..11437cc98 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java @@ -150,7 +150,7 @@ public class ATPLogicLoop { /* 缓解EB检查 */ if (train.isEB()) { - if (train.isRMMode() && train.getControlLeaver() <= 0) { //停车、RM模式、操纵杆非牵引位 + if (train.isRMMode() && train.isLeverNotInTractionGear()) { //停车、RM模式、操纵杆非牵引位 atpService.cancelSignalEB(train); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPService.java index 696e92158..466ee6b6e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPService.java @@ -374,7 +374,7 @@ public class ATPService { return false; if (!VirtualRealityTrain.Handwheel.ATO.equals(train.getGear())) //工况手轮不在ATO位 return false; - if (train.getControlLeaver() != 0) //操纵杆不在惰行位 + if (!train.isLeverInCoastingGear()) //操纵杆不在惰行位 return false; if (train.getAtoSpeed() <= 0) //列车无推荐速度 return false; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java index 1cfb16cd0..812192b9b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java @@ -204,15 +204,9 @@ public class RobotLogicLoop { break; case CM: MaService.Ma ma = train.getMa2(); - speedCurve = SpeedCurve.calculateAtoStopCurveAndUpdate(train, ma, targetPosition); -// Float recommendedSpeedMax = Stream.of(train.getAtpSpeedMax(), train.getSpeedLimit() * 0.9f, train.getAtoSpeedMax()) -// .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); + if (ma != null) { + speedCurve = ma.getAtoStopCurve(); + } break; case RM: speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right, @@ -228,10 +222,8 @@ public class RobotLogicLoop { train.setTargetDistance(distance); if (speedCurve != null) { float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance()); -// train.setAtoSpeed(atoSpeed); atoService.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance(), atoSpeed); } -// doControlBySpeedCurve(simulation, train, speedCurve, speedCurve.getTotalDistance()); } /**