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

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,7 +60,6 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) { private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) {
Stand stand = vrPsl.getStand(); Stand stand = vrPsl.getStand();
synchronized (vrPsl) {
switch (button) { switch (button) {
case YXJZ: case YXJZ:
vrPsl.setYxjzKey(!vrPsl.isYxjzKey()); vrPsl.setYxjzKey(!vrPsl.isYxjzKey());
@ -80,7 +79,6 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
break; break;
} }
} }
}
@Override @Override
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on) { public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on) {

View File

@ -306,7 +306,7 @@ public class ATPLogicLoop {
} }
break; break;
case OPEN_DOOR: // 开门 case OPEN_DOOR: // 开门
if (!train.getDoorMode().equals(VirtualRealityTrain.DoorMode.MM)) { // 不是自动开门 if (train.isAutoOpenDoor()) {
this.atoService.syncOpenDoor(simulation, train); this.atoService.syncOpenDoor(simulation, train);
} }
if (this.isAllDoorOpen(simulation, train)) { if (this.isAllDoorOpen(simulation, train)) {
@ -316,16 +316,7 @@ public class ATPLogicLoop {
case BOARD: // 乘客乘降 case BOARD: // 乘客乘降
break; break;
case CLOSE_DOOR: // 关门 case CLOSE_DOOR: // 关门
// Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight()); if (train.isAutoCloseDoor()) {
// if (Objects.nonNull(signal) && !signal.isNormalOpen()) {
// if (!train.isRMMode() && !train.isNRMMode()) {
// // 信号机未正常开放
// break;
// }
// }
// 可以关门
// this.atoService.syncCloseDoor(simulation, train);
if (train.getDoorMode().equals(VirtualRealityTrain.DoorMode.AA)) { // 自动关门
this.atoService.syncCloseDoor(simulation, train); this.atoService.syncCloseDoor(simulation, train);
} }
if (this.isAllDoorClose(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.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vr.StandParkedTrainActivity; 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.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.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve; import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve;
@ -66,9 +67,6 @@ public class RobotLogicLoop {
} }
robotReplyControlTransferApplicationLogicLoop(simulation); robotReplyControlTransferApplicationLogicLoop(simulation);
robotStationControlAutoTransfer(simulation); robotStationControlAutoTransfer(simulation);
// executor.execute(() -> robotDriverLogicLoop(simulation));
// executor.execute(() -> robotReplyControlTransferApplicationLogicLoop(simulation));
// executor.execute(() -> robotStationControlAutoTransfer(simulation));
} }
private void robotOpenATO(Simulation simulation, VirtualRealityTrain train) { private void robotOpenATO(Simulation simulation, VirtualRealityTrain train) {
@ -77,30 +75,15 @@ public class RobotLogicLoop {
return; return;
switch (activity) { switch (activity) {
case OPEN_DOOR: case OPEN_DOOR:
if (!train.isAtoOn()) { if (!train.isAutoOpenDoor()) {
atoService.syncOpenDoor(simulation, train); atoService.syncOpenDoor(simulation, train);
usePsl2ControlPsd(simulation, train, true);
} }
break; break;
case CLOSE_DOOR: case CLOSE_DOOR:
if (!train.isAutoCloseDoor()) {
atoService.syncCloseDoor(simulation, train); atoService.syncCloseDoor(simulation, train);
SectionPosition headPosition = train.getHeadPosition(); usePsl2ControlPsd(simulation, train, false);
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);
}
}
} }
break; break;
case START: 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);
}
}
}
}
/** /**
* 机器人司机逻辑循环 * 机器人司机逻辑循环
*/ */