大铁增加点灯灭灯操作;大铁不执行根据信号机模式自动切换点灯灭灯状态逻辑;修改部分列车运行指令的寻路逻辑;修改停车指令结束条件;修改大铁自动驾驶寻路逻辑
This commit is contained in:
parent
ba0c05eb64
commit
66d21c1778
@ -317,6 +317,16 @@ public class Operation {
|
|||||||
*/
|
*/
|
||||||
Signal_Set_Guide,
|
Signal_Set_Guide,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点灯
|
||||||
|
*/
|
||||||
|
Signal_Turn_On,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 灭灯
|
||||||
|
*/
|
||||||
|
Signal_Turn_Off,
|
||||||
|
|
||||||
//--------------------------- 站台操作 ---------------------------
|
//--------------------------- 站台操作 ---------------------------
|
||||||
/**
|
/**
|
||||||
* 设置跳停
|
* 设置跳停
|
||||||
|
@ -316,4 +316,20 @@ public class SignalOperateHandler {
|
|||||||
ciApiService.setGuide(simulation, signalCode, routeCode);
|
ciApiService.setGuide(simulation, signalCode, routeCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信号机点灯
|
||||||
|
*/
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Signal_Turn_On)
|
||||||
|
public void signalTurnOn(Simulation simulation, String signalCode) {
|
||||||
|
ciApiService.signalTurnOn(simulation, signalCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信号机灭灯
|
||||||
|
*/
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Signal_Turn_Off)
|
||||||
|
public void signalTurnOff(Simulation simulation, String signalCode) {
|
||||||
|
ciApiService.signalTurnOff(simulation, signalCode);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -359,4 +359,8 @@ public interface CiApiService {
|
|||||||
void switchMasterLock(Simulation simulation, String stationCode, Station.Throat throat);
|
void switchMasterLock(Simulation simulation, String stationCode, Station.Throat throat);
|
||||||
|
|
||||||
void switchMasterUnlock(Simulation simulation, String stationCode, Station.Throat throat);
|
void switchMasterUnlock(Simulation simulation, String stationCode, Station.Throat throat);
|
||||||
|
|
||||||
|
void signalTurnOn(Simulation simulation, String signalCode);
|
||||||
|
|
||||||
|
void signalTurnOff(Simulation simulation, String signalCode);
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,12 @@ package club.joylink.rtss.simulation.cbtc.CI;
|
|||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.simulation.cbtc.CI.device.*;
|
import club.joylink.rtss.simulation.cbtc.CI.device.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -36,6 +39,9 @@ public class CiApiServiceImpl2 implements CiApiService {
|
|||||||
private CiService ciService;
|
private CiService ciService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CiStandService standService;
|
private CiStandService standService;
|
||||||
|
@Autowired
|
||||||
|
private VirtualRealityDeviceService virtualRealityDeviceService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void blockadeSection(Simulation simulation, String sectionCode) {
|
public void blockadeSection(Simulation simulation, String sectionCode) {
|
||||||
@ -692,6 +698,27 @@ public class CiApiServiceImpl2 implements CiApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void signalTurnOn(Simulation simulation, String signalCode) {
|
||||||
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
Signal signal = repository.getByCode(signalCode, Signal.class);
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNull(signal.getLockedRoute(), "信号机有锁闭进路,禁止点灯");
|
||||||
|
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotNull(vrSignal, signal.debugStr() + "无实体信号机");
|
||||||
|
virtualRealityDeviceService.control(simulation, vrSignal, vrSignal.getModel().getDefaultAspect());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void signalTurnOff(Simulation simulation, String signalCode) {
|
||||||
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
Signal signal = repository.getByCode(signalCode, Signal.class);
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotTrue(signal.isShunting(), "调车信号机无法灭灯");
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNull(signal.getLockedRoute(), "信号机有锁闭进路,禁止灭灯");
|
||||||
|
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotNull(vrSignal, signal.debugStr() + "无实体信号机");
|
||||||
|
virtualRealityDeviceService.control(simulation, vrSignal, SignalAspect.No);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取计轴器并为预复位/复位操作检查设备状态
|
* 获取计轴器并为预复位/复位操作检查设备状态
|
||||||
*/
|
*/
|
||||||
|
@ -68,6 +68,7 @@ public class CiSignalControlService {
|
|||||||
* @param signal
|
* @param signal
|
||||||
*/
|
*/
|
||||||
public void controlLightOfSignal(Simulation simulation, Signal signal) {
|
public void controlLightOfSignal(Simulation simulation, Signal signal) {
|
||||||
|
if (!simulation.getRepository().getConfig().isRailway()) {
|
||||||
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||||
if (signal.isCbtcMode() && !signal.isForcePhysical() && !signal.isLogicLight()) {
|
if (signal.isCbtcMode() && !signal.isForcePhysical() && !signal.isLogicLight()) {
|
||||||
if (vrSignal != null) {
|
if (vrSignal != null) {
|
||||||
@ -81,6 +82,7 @@ public class CiSignalControlService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 封锁(封锁后,包含信号机的进路不能排列)
|
* 封锁(封锁后,包含信号机的进路不能排列)
|
||||||
|
@ -22,13 +22,13 @@ public class DeviceStatusServiceImpl implements DeviceStatusService {
|
|||||||
@Override
|
@Override
|
||||||
public void init(Simulation simulation) {
|
public void init(Simulation simulation) {
|
||||||
simulation.reset(); //这个初始化现在不可或缺,有一些数据在仿真构建时没有,仅在初始化时构建
|
simulation.reset(); //这个初始化现在不可或缺,有一些数据在仿真构建时没有,仅在初始化时构建
|
||||||
|
// 虚拟真实设备初始化
|
||||||
|
virtualRealityDeviceService.reset(simulation);
|
||||||
// 信号机状态初始化
|
// 信号机状态初始化
|
||||||
this.initSignal(simulation);
|
this.initSignal(simulation);
|
||||||
this.buildSingleLockedSwitch(simulation);
|
this.buildSingleLockedSwitch(simulation);
|
||||||
this.initRoute(simulation);
|
this.initRoute(simulation);
|
||||||
this.initStationControlMode(simulation);
|
this.initStationControlMode(simulation);
|
||||||
// 虚拟真实设备初始化
|
|
||||||
virtualRealityDeviceService.reset(simulation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,8 +54,9 @@ public class DeviceStatusServiceImpl implements DeviceStatusService {
|
|||||||
|
|
||||||
private void initSignal(Simulation simulation) {
|
private void initSignal(Simulation simulation) {
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
// 初始化非ctc虚拟真实信号机点红灯
|
|
||||||
List<Signal> signalList = repository.getSignalList();
|
List<Signal> signalList = repository.getSignalList();
|
||||||
|
if (!repository.getConfig().isRailway()) {
|
||||||
|
// 初始化非ctc虚拟真实信号机点红灯
|
||||||
for (Signal signal : signalList) {
|
for (Signal signal : signalList) {
|
||||||
if (!signal.isCtc()) {
|
if (!signal.isCtc()) {
|
||||||
VirtualRealitySignal vrSignal = repository.getVRByCode(signal.getCode(), VirtualRealitySignal.class);
|
VirtualRealitySignal vrSignal = repository.getVRByCode(signal.getCode(), VirtualRealitySignal.class);
|
||||||
@ -63,6 +64,13 @@ public class DeviceStatusServiceImpl implements DeviceStatusService {
|
|||||||
vrSignal.finish();
|
vrSignal.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else { //大铁线路暂时默认点灯
|
||||||
|
for (Signal signal : signalList) {
|
||||||
|
VirtualRealitySignal vrSignal = repository.getVRByCode(signal.getCode(), VirtualRealitySignal.class);
|
||||||
|
vrSignal.control(vrSignal.getModel().getDefaultAspect());
|
||||||
|
vrSignal.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildSingleLockedSwitch(Simulation simulation) {
|
private void buildSingleLockedSwitch(Simulation simulation) {
|
||||||
|
@ -621,7 +621,9 @@ public class CommandBO {
|
|||||||
command.getTargetMember().setCommand(null);
|
command.getTargetMember().setCommand(null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (train.isStop()) {
|
||||||
targetMember.setCommand(null);
|
targetMember.setCommand(null);
|
||||||
|
}
|
||||||
// 设置目标位置
|
// 设置目标位置
|
||||||
return buildDriveStep(train.getHeadPosition());
|
return buildDriveStep(train.getHeadPosition());
|
||||||
}
|
}
|
||||||
@ -886,7 +888,8 @@ public class CommandBO {
|
|||||||
|
|
||||||
SectionPosition sectionPosition = null;
|
SectionPosition sectionPosition = null;
|
||||||
for (int i = 0; i < 30; i++) {
|
for (int i = 0; i < 30; i++) {
|
||||||
section = section.getNextRunningSectionOf(right);
|
section = section.findNextRunningSectionBaseRealSwitch(right);
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotNull(section, "引导信号前方未找到停车位置");
|
||||||
Signal signal = section.getSignalOf(right);
|
Signal signal = section.getSignalOf(right);
|
||||||
if (section.isStandTrack() || section.isTurnBackTrack()) {
|
if (section.isStandTrack() || section.isTurnBackTrack()) {
|
||||||
sectionPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
sectionPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||||
|
@ -27,7 +27,7 @@ public class CalculateService {
|
|||||||
if (offset < 0) { // 向左
|
if (offset < 0) { // 向左
|
||||||
Section leftSection;
|
Section leftSection;
|
||||||
if (baseReal) {
|
if (baseReal) {
|
||||||
leftSection = baseSection.getNextRunningSectionBaseRealSwitch(false);
|
leftSection = baseSection.findNextRunningSectionBaseRealSwitch(false);
|
||||||
} else {
|
} else {
|
||||||
leftSection = baseSection.getNextRunningSectionOf(false);
|
leftSection = baseSection.getNextRunningSectionOf(false);
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ public class CalculateService {
|
|||||||
} else { // 向右
|
} else { // 向右
|
||||||
Section rightSection;
|
Section rightSection;
|
||||||
if (baseReal) {
|
if (baseReal) {
|
||||||
rightSection = baseSection.getNextRunningSectionBaseRealSwitch(true);
|
rightSection = baseSection.findNextRunningSectionBaseRealSwitch(true);
|
||||||
} else {
|
} else {
|
||||||
rightSection = baseSection.getNextRunningSectionOf(true);
|
rightSection = baseSection.getNextRunningSectionOf(true);
|
||||||
}
|
}
|
||||||
@ -519,7 +519,7 @@ public class CalculateService {
|
|||||||
Section section = source;
|
Section section = source;
|
||||||
while (!section.getCode().equals(target.getCode()) && loop < 20) {
|
while (!section.getCode().equals(target.getCode()) && loop < 20) {
|
||||||
loop++;
|
loop++;
|
||||||
Section temp = section.getNextRunningSectionBaseRealSwitch(right);
|
Section temp = section.findNextRunningSectionBaseRealSwitch(right);
|
||||||
if (Objects.nonNull(temp)) { // 不为空
|
if (Objects.nonNull(temp)) { // 不为空
|
||||||
section = temp;
|
section = temp;
|
||||||
occupySectionList.add(section);
|
occupySectionList.add(section);
|
||||||
@ -628,7 +628,7 @@ public class CalculateService {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
while (count < 100) {
|
while (count < 100) {
|
||||||
++count;
|
++count;
|
||||||
Section nextSection = temp.getNextRunningSectionBaseRealSwitch(right);
|
Section nextSection = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||||
if (Objects.equals(nextSection, front)) {// 找到
|
if (Objects.equals(nextSection, front)) {// 找到
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -403,7 +403,7 @@ public class Section extends DelayUnlockDevice {
|
|||||||
/**
|
/**
|
||||||
* 基于真实道岔找下一个可运行到的区段
|
* 基于真实道岔找下一个可运行到的区段
|
||||||
*/
|
*/
|
||||||
public Section getNextRunningSectionBaseRealSwitch(boolean right) {
|
public Section findNextRunningSectionBaseRealSwitch(boolean right) {
|
||||||
if (right && Objects.nonNull(this.rightSection)) {
|
if (right && Objects.nonNull(this.rightSection)) {
|
||||||
return this.rightSection;
|
return this.rightSection;
|
||||||
} else if (!right && Objects.nonNull(this.leftSection)) {
|
} else if (!right && Objects.nonNull(this.leftSection)) {
|
||||||
|
@ -847,7 +847,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
boolean right = this.right;
|
boolean right = this.right;
|
||||||
Section section = headPosition.getSection();
|
Section section = headPosition.getSection();
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
section = section.getNextRunningSectionOf(right);
|
section = section.findNextRunningSectionBaseRealSwitch(right);
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -871,7 +871,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 30; i++) {
|
for (int i = 0; i < 30; i++) {
|
||||||
Section nextSection = section.getNextRunningSectionBaseRealSwitch(right);
|
Section nextSection = section.findNextRunningSectionBaseRealSwitch(right);
|
||||||
if (nextSection == null) {
|
if (nextSection == null) {
|
||||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation,
|
throw new SimulationException(SimulationExceptionType.Invalid_Operation,
|
||||||
String.format("信号机[%s]前方未找到站台轨或折返轨", signal.getName()));
|
String.format("信号机[%s]前方未找到站台轨或折返轨", signal.getName()));
|
||||||
|
@ -49,7 +49,7 @@ public class TrainTargetUpdateService {
|
|||||||
if (temp == null)
|
if (temp == null)
|
||||||
break;
|
break;
|
||||||
if (!temp.isFunctionTrack()) {
|
if (!temp.isFunctionTrack()) {
|
||||||
temp = temp.getNextRunningSectionBaseRealSwitch(right);
|
temp = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Signal signal = temp.getSignalOf(right);
|
Signal signal = temp.getSignalOf(right);
|
||||||
@ -61,7 +61,7 @@ public class TrainTargetUpdateService {
|
|||||||
if (temp.isNormalStandTrack() || temp.isTransferTrack()) {
|
if (temp.isNormalStandTrack() || temp.isTransferTrack()) {
|
||||||
if (temp.isNormalStandTrack()) {
|
if (temp.isNormalStandTrack()) {
|
||||||
if (temp.getStandList().stream().anyMatch(stand -> stand.isJumpStop(train.getGroupNumber()))) { //该列车应在站台跳停
|
if (temp.getStandList().stream().anyMatch(stand -> stand.isJumpStop(train.getGroupNumber()))) { //该列车应在站台跳停
|
||||||
temp = temp.getNextRunningSectionBaseRealSwitch(right);
|
temp = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public class TrainTargetUpdateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
temp = temp.getNextRunningSectionBaseRealSwitch(right);
|
temp = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||||
}
|
}
|
||||||
return newTarget;
|
return newTarget;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ public class TrainTargetUpdateService {
|
|||||||
newTarget = section;
|
newTarget = section;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
section = section.getNextRunningSectionBaseRealSwitch(right);
|
section = section.findNextRunningSectionBaseRealSwitch(right);
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -157,7 +157,7 @@ public class RobotLogicLoop {
|
|||||||
//准备发车
|
//准备发车
|
||||||
robotReadyForDeparture(simulation, train);
|
robotReadyForDeparture(simulation, train);
|
||||||
//机器人驾驶
|
//机器人驾驶
|
||||||
if (train.getRobotTargetPosition() != null) {
|
if (driver.getCommand() != null) { //如果有和驾驶行为不冲突的指令,这里需要做修改
|
||||||
robotDriveByCommand(simulation, driver, train);
|
robotDriveByCommand(simulation, driver, train);
|
||||||
} else if (railway) {
|
} else if (railway) {
|
||||||
railRobotDrive(simulation, train);
|
railRobotDrive(simulation, train);
|
||||||
@ -166,7 +166,7 @@ public class RobotLogicLoop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 大铁机器人自动驾驶。
|
* 大铁机器人自动驾驶。(目前的驾驶逻辑是针对RM/NRM模式驾驶)
|
||||||
* 在确认列车自身状态正确的情况下(车门是关闭状态等),如果是没有计划的车次,则只看信号;如果是有计划的车次,还需要看计划
|
* 在确认列车自身状态正确的情况下(车门是关闭状态等),如果是没有计划的车次,则只看信号;如果是有计划的车次,还需要看计划
|
||||||
*/
|
*/
|
||||||
private void railRobotDrive(Simulation simulation, VirtualRealityTrain train) {
|
private void railRobotDrive(Simulation simulation, VirtualRealityTrain train) {
|
||||||
@ -208,7 +208,7 @@ public class RobotLogicLoop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section next = nextSection.getNextRunningSectionOf(right);
|
Section next = nextSection.findNextRunningSectionBaseRealSwitch(right);
|
||||||
if (next == null) {
|
if (next == null) {
|
||||||
targetPosition = new SectionPosition(nextSection, right ? nextSection.getLen() - 10 : 10); //轨道尽头10m处
|
targetPosition = new SectionPosition(nextSection, right ? nextSection.getLen() - 10 : 10); //轨道尽头10m处
|
||||||
break;
|
break;
|
||||||
@ -264,7 +264,7 @@ public class RobotLogicLoop {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nextSection = nextSection.getNextRunningSectionBaseRealSwitch(right);
|
nextSection = nextSection.findNextRunningSectionBaseRealSwitch(right);
|
||||||
if (nextSection == null)
|
if (nextSection == null)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user