修改自动/联动开关门判定并添加机器人开关门逻辑

This commit is contained in:
joylink_zhangsai 2021-09-27 14:43:23 +08:00
parent 3ebfe664d5
commit d7b5df2b3b
3 changed files with 67 additions and 53 deletions

View File

@ -60,25 +60,23 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) {
Stand stand = vrPsl.getStand();
synchronized (vrPsl) {
switch (button) {
case YXJZ:
vrPsl.setYxjzKey(!vrPsl.isYxjzKey());
break;
case HSJC:
vrPsl.setHsjcKey(!vrPsl.isHsjcKey());
ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
break;
case KM:
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break;
case GM:
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break;
case SD:
vrPsl.setSdButton(!vrPsl.isSdButton());
break;
}
switch (button) {
case YXJZ:
vrPsl.setYxjzKey(!vrPsl.isYxjzKey());
break;
case HSJC:
vrPsl.setHsjcKey(!vrPsl.isHsjcKey());
ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
break;
case KM:
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break;
case GM:
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
break;
case SD:
vrPsl.setSdButton(!vrPsl.isSdButton());
break;
}
}

View File

@ -306,7 +306,7 @@ public class ATPLogicLoop {
}
break;
case OPEN_DOOR: // 开门
if (!train.getDoorMode().equals(VirtualRealityTrain.DoorMode.MM)) { // 不是自动开门
if (train.isAutoOpenDoor()) {
this.atoService.syncOpenDoor(simulation, train);
}
if (this.isAllDoorOpen(simulation, train)) {
@ -316,16 +316,7 @@ public class ATPLogicLoop {
case BOARD: // 乘客乘降
break;
case CLOSE_DOOR: // 关门
// Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight());
// if (Objects.nonNull(signal) && !signal.isNormalOpen()) {
// if (!train.isRMMode() && !train.isNRMMode()) {
// // 信号机未正常开放
// break;
// }
// }
// 可以关门
// this.atoService.syncCloseDoor(simulation, train);
if (train.getDoorMode().equals(VirtualRealityTrain.DoorMode.AA)) { // 自动关门
if (train.isAutoCloseDoor()) {
this.atoService.syncCloseDoor(simulation, train);
}
if (this.isAllDoorClose(simulation, train)) {

View File

@ -18,6 +18,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferReplyVO;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vr.StandParkedTrainActivity;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve;
@ -66,9 +67,6 @@ public class RobotLogicLoop {
}
robotReplyControlTransferApplicationLogicLoop(simulation);
robotStationControlAutoTransfer(simulation);
// executor.execute(() -> robotDriverLogicLoop(simulation));
// executor.execute(() -> robotReplyControlTransferApplicationLogicLoop(simulation));
// executor.execute(() -> robotStationControlAutoTransfer(simulation));
}
private void robotOpenATO(Simulation simulation, VirtualRealityTrain train) {
@ -77,30 +75,15 @@ public class RobotLogicLoop {
return;
switch (activity) {
case OPEN_DOOR:
if (!train.isAtoOn()) {
if (!train.isAutoOpenDoor()) {
atoService.syncOpenDoor(simulation, train);
usePsl2ControlPsd(simulation, train, true);
}
break;
case CLOSE_DOOR:
atoService.syncCloseDoor(simulation, train);
SectionPosition headPosition = train.getHeadPosition();
Section section = headPosition.getSection();
List<Stand> standList = section.getStandList();
if (!CollectionUtils.isEmpty(standList)) {
for (Stand stand : standList) {
PSD psd = stand.getPsd();
if (psd != null && !psd.isCloseAndLock()) {
VirtualRealityPsl vrPsl = stand.getVrPsl();
if (!vrPsl.isAllowOperation()) { //确保此时允许操作
iVirtualRealityPslService.pressTheButton(simulation.getId(),
stand.getCode(), VirtualRealityPsl.Button.YXJZ);
}
iVirtualRealityPslService.pressTheButton(simulation.getId(),
stand.getCode(), VirtualRealityPsl.Button.GM);
iVirtualRealityPslService.pressTheButton(simulation.getId(),
stand.getCode(), VirtualRealityPsl.Button.YXJZ);
}
}
if (!train.isAutoCloseDoor()) {
atoService.syncCloseDoor(simulation, train);
usePsl2ControlPsd(simulation, train, false);
}
break;
case START:
@ -113,6 +96,48 @@ public class RobotLogicLoop {
}
}
/**
* 使用psl控制屏蔽门
*/
private void usePsl2ControlPsd(Simulation simulation, VirtualRealityTrain train, boolean open) {
SectionPosition headPosition = train.getHeadPosition();
Section section = headPosition.getSection();
List<Stand> standList = section.getStandList();
if (!CollectionUtils.isEmpty(standList)) {
for (Stand stand : standList) {
PSD psd = stand.getPsd();
if (psd == null)
continue;
VirtualRealityScreenDoor vrPsd = psd.getVirtualScreenDoor();
if (open) {
if (!vrPsd.isClose() || vrPsd.isSettingOpen()) {
continue;
}
} else {
if (vrPsd.isLockAndClose() || vrPsd.isSettingClose()) {
continue;
}
}
VirtualRealityPsl vrPsl = stand.getVrPsl();
if (!vrPsl.isAllowOperation()) { //确保此时允许操作
iVirtualRealityPslService.pressTheButton(simulation.getId(),
stand.getCode(), VirtualRealityPsl.Button.YXJZ);
}
if (open) {
iVirtualRealityPslService.pressTheButton(simulation.getId(),
stand.getCode(), VirtualRealityPsl.Button.KM);
} else {
iVirtualRealityPslService.pressTheButton(simulation.getId(),
stand.getCode(), VirtualRealityPsl.Button.GM);
}
if (vrPsl.isAllowOperation()) { //将允许禁止钥匙打到禁止位
iVirtualRealityPslService.pressTheButton(simulation.getId(),
stand.getCode(), VirtualRealityPsl.Button.YXJZ);
}
}
}
}
/**
* 机器人司机逻辑循环
*/