Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
6a194ce09c
@ -35,7 +35,6 @@ public class Operation {
|
||||
public final static int FAULT = 1;
|
||||
public final static int OTHER = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
*/
|
||||
@ -868,16 +867,6 @@ public class Operation {
|
||||
*/
|
||||
Driver_Stop(Operation.OTHER),
|
||||
|
||||
/**
|
||||
* 确认运行至前方站
|
||||
*/
|
||||
Drive_Ahead(Operation.OTHER),
|
||||
|
||||
/**
|
||||
* 进路闭塞法行车
|
||||
*/
|
||||
Route_Block_Drive(Operation.OTHER),
|
||||
|
||||
/**
|
||||
* 开关门
|
||||
*/
|
||||
@ -1286,7 +1275,37 @@ public class Operation {
|
||||
/**
|
||||
* 给出票据
|
||||
*/
|
||||
RAIL_GIVE_TICKET_TO(Operation.OTHER);
|
||||
RAIL_GIVE_TICKET_TO(Operation.OTHER),
|
||||
|
||||
//----------------------------会话信息------------------------------
|
||||
/**
|
||||
* 获取会话信息
|
||||
*/
|
||||
Conversation_Get_Info(Operation.CLIENT),
|
||||
/**
|
||||
* 会话列表信息
|
||||
*/
|
||||
Conversation_List(Operation.CLIENT),
|
||||
/**
|
||||
* 发起会话
|
||||
*/
|
||||
Conversation_Start(Operation.CLIENT),
|
||||
/**
|
||||
* 接受会话
|
||||
*/
|
||||
Conversation_Accept(Operation.CLIENT),
|
||||
/**
|
||||
* 结束会话
|
||||
*/
|
||||
Conversation_Over(Operation.CLIENT),
|
||||
/**
|
||||
* 发送会话消息(语音输入)
|
||||
*/
|
||||
Conversation_Chat_Audio(Operation.CLIENT),
|
||||
/**
|
||||
* 发送会话消息(文字输入)
|
||||
*/
|
||||
Conversation_Chat_Text(Operation.CLIENT);
|
||||
|
||||
int index;
|
||||
|
||||
|
@ -185,27 +185,11 @@ public class DriverOperateHandler {
|
||||
simulationRobotService.stopTrain(simulation, simulationMember, groupNumber, eb);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认运行至前方站
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Drive_Ahead)
|
||||
public void driveAhead(Simulation simulation, SimulationMember simulationMember, String groupNumber) {
|
||||
ATPService.driveAhead(simulation, groupNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进路闭塞法行车
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Route_Block_Drive)
|
||||
public void routeBlockDrive(Simulation simulation, SimulationMember simulationMember, String groupNumber) {
|
||||
ATPService.routeBlockDrive(simulation, groupNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开关门
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Open_Or_Close_Door)
|
||||
public void openOrCloseDoor(Simulation simulation, SimulationMember simulationMember, String groupNumber) {
|
||||
public void openOrCloseDoor(Simulation simulation, String groupNumber) {
|
||||
ATPService.openOrCloseDoor(simulation, groupNumber);
|
||||
}
|
||||
|
||||
@ -213,7 +197,7 @@ public class DriverOperateHandler {
|
||||
* 回库
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Inbound)
|
||||
public void inbound(Simulation simulation, SimulationMember simulationMember, String groupNumber) {
|
||||
public void inbound(Simulation simulation,String groupNumber) {
|
||||
ATPService.inbound(simulation, groupNumber);
|
||||
}
|
||||
|
||||
@ -221,7 +205,7 @@ public class DriverOperateHandler {
|
||||
* 修改预选模式
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Change_Preselection_Mode)
|
||||
public void changePreselectionMode(Simulation simulation, SimulationMember simulationMember, String groupNumber
|
||||
public void changePreselectionMode(Simulation simulation, String groupNumber
|
||||
, VirtualRealityTrain.PreselectionMode preselectionMode) {
|
||||
ATPService.changePreselectionMode(simulation, groupNumber, preselectionMode);
|
||||
}
|
||||
@ -230,7 +214,7 @@ public class DriverOperateHandler {
|
||||
* 转NRM模式
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Apply_NRM)
|
||||
public void applyNRM(Simulation simulation, SimulationMember simulationMember, String groupNumber) {
|
||||
public void applyNRM(Simulation simulation, String groupNumber) {
|
||||
ATPService.applyNRM(simulation, groupNumber);
|
||||
}
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ public class AtsTrainService {
|
||||
}
|
||||
//找要越过的信号机
|
||||
Section section = headPosition.getSection();
|
||||
if (param.isThroughRedSignal()) {
|
||||
if (param.isThroughRedSignal()) { // 越红灯行驶
|
||||
Signal signal = section.getSignalOf(right);
|
||||
boolean b = false;
|
||||
if (signal != null && signal.getPosition().isAheadOf(headPosition, right)) {
|
||||
@ -470,7 +470,7 @@ public class AtsTrainService {
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(b, "需要车头所在区段前方有同向信号机,且同向信号机为禁止信号");
|
||||
param.setThroughSignal(signal);
|
||||
param.setThroughSignalAspect(signal.getVirtualSignal().getModel().getDefaultAspect());
|
||||
} else if (param.isThroughGuideSignal()) {
|
||||
} else if (param.isThroughGuideSignal()) { // 越引导行驶
|
||||
Signal signal = section.getSignalOf(right);
|
||||
boolean b = false;
|
||||
if (signal != null && signal.getPosition().isAheadOf(headPosition, right)) {
|
||||
@ -480,11 +480,28 @@ public class AtsTrainService {
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(b, "需要车头所在区段前方有同向信号机,且同向信号机为引导信号");
|
||||
param.setThroughSignal(signal);
|
||||
param.setThroughSignalAspect(signal.getVirtualSignal().getModel().getDefaultAspect());
|
||||
} else if (param.isDriverNextStand()){ // 行驶至前方车站
|
||||
// 列车车头所在区段
|
||||
Section headSection = train.getHeadPosition().getSection();
|
||||
// 停车目的区段
|
||||
if (section.isStandTrack()) {
|
||||
targetPosition = new SectionPosition(headSection, headSection.getStopPointByDirection(train.isRight()));
|
||||
} else {
|
||||
targetPosition = train.calculateNextStandStopPosition();
|
||||
if (targetPosition == null && train.getTarget() != null) {
|
||||
targetPosition = new SectionPosition(train.getTarget(), train.getTarget().getStopPointByDirection(train.isRight()));
|
||||
}
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(targetPosition, train.debugStr() + "找不到下一个停车点");
|
||||
}
|
||||
atpService.changePreselectionMode(train, VirtualRealityTrain.PreselectionMode.RM);
|
||||
} else if (param.isRouteBlockDriver()) { // 进路闭塞行车
|
||||
if (!train.isAMMode()) {
|
||||
atpService.changePreselectionMode(train, VirtualRealityTrain.PreselectionMode.AM_C);
|
||||
}
|
||||
}else {
|
||||
param.setThroughSignal(null);
|
||||
param.setThroughSignalAspect(null);
|
||||
}
|
||||
|
||||
param.setTargetPosition(targetPosition);
|
||||
train.setRobotDriveParam(param);
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
package club.joylink.rtss.simulation.cbtc.conversation;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationVO;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会话操作
|
||||
*/
|
||||
@OperateHandler
|
||||
@Slf4j
|
||||
public class ConversationOperateHandler {
|
||||
@Autowired
|
||||
private ConversationManagerService conversationManagerService;
|
||||
|
||||
/**
|
||||
* 获取会话信息
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Conversation_Get_Info)
|
||||
public ConversationVO getConversation(Simulation simulation, SimulationMember member, String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话列表信息
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Conversation_List)
|
||||
public List<ConversationVO> getAllConversations(Simulation simulation, SimulationMember member){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起会话
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Conversation_Start)
|
||||
public ConversationVO startConversation(Simulation simulation, SimulationMember member
|
||||
, CommunicationObject object, List<String> memberIds){
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接受会话
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Conversation_Accept)
|
||||
public ConversationVO acceptConversationInvite(Simulation simulation, SimulationMember member, String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束会话
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Conversation_Over)
|
||||
public ConversationVO overConversation(Simulation simulation, SimulationMember member, String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送会话消息(语音输入)
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Conversation_Chat_Audio)
|
||||
public ConversationVO audioChat(Simulation simulation, SimulationMember member, String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送会话消息(文字输入)
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Conversation_Chat_Text)
|
||||
public ConversationVO textChat(Simulation simulation, SimulationMember member, String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -19,6 +19,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain.PreselectionMode;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
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.service.ATOService;
|
||||
import lombok.NonNull;
|
||||
@ -298,18 +299,9 @@ public class ATPService {
|
||||
}
|
||||
|
||||
public void openOrCloseDoor(Simulation simulation, VirtualRealityTrain train, boolean right, boolean open) {
|
||||
if (train.getSpeed() != 0) {
|
||||
log.warn(String.format("列车[%s]未停止,不能操作车门", train.getGroupNumber()));
|
||||
return;
|
||||
}
|
||||
if (!train.getDoorMode().isAuto(open)) {
|
||||
log.warn(String.format("列车[%s]门模式自动,不能操作车门", train.getGroupNumber()));
|
||||
return;
|
||||
}
|
||||
if (!train.getDoorSelection().match(right)) {
|
||||
log.warn(String.format("列车[%s]门选择与操作不匹配", train.getGroupNumber()));
|
||||
return;
|
||||
}
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getSpeed() == 0, String.format("列车[%s]未停止,不能操作车门", train.getGroupNumber()));
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorMode().isAuto(open), String.format("列车[%s]门模式自动,不能操作车门", train.getGroupNumber()));
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorSelection().match(right),String.format("列车[%s]门选择与操作不匹配", train.getGroupNumber()));
|
||||
List<Stand> standList = train.getHeadPosition().getSection().getStandList();
|
||||
VirtualRealityTrain.Door door = train.getDoorByDirection(right);
|
||||
if (open) {
|
||||
@ -496,52 +488,6 @@ public class ATPService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认运行至前方站
|
||||
*/
|
||||
public void driveAhead(Simulation simulation, String groupNumber) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
// 列车车头所在区段
|
||||
Section section = train.getHeadPosition().getSection();
|
||||
// 停车目的区段
|
||||
SectionPosition standStopPosition;
|
||||
if (section.isStandTrack()) {
|
||||
standStopPosition = new SectionPosition(section, section.getStopPointByDirection(train.isRight()));
|
||||
} else {
|
||||
standStopPosition = train.calculateNextStandStopPosition();
|
||||
if (standStopPosition == null && train.getTarget() != null) {
|
||||
standStopPosition = new SectionPosition(train.getTarget(), train.getTarget().getStopPointByDirection(train.isRight()));
|
||||
}
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(standStopPosition, train.debugStr() + "找不到下一个停车点");
|
||||
}
|
||||
if (!train.isStopAtThePosition(standStopPosition)) { //如果列车没停到目标位置
|
||||
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.MANUAL)) { // 改变工况手轮档位
|
||||
changeGear(train, VirtualRealityTrain.Handwheel.MANUAL);
|
||||
}
|
||||
float percent = train.isEB() && (!train.isStop() || !train.isLeverNotInTractionGear())
|
||||
? -2F : (!train.isStop() ? -1F : 0);
|
||||
if (percent != 0) {
|
||||
changeTrainForce(train, percent); // 改变列车的牵引/
|
||||
}
|
||||
if ((!DriveMode.RM.equals(train.getDriveMode()) || train.isEB()) && !train.isNRMMode()) {
|
||||
changePreselectionMode(train, PreselectionMode.RM); // 修改预选模式
|
||||
}
|
||||
train.setRobotTargetPosition(standStopPosition);
|
||||
train.getRobotDriveParam().setRun(true);
|
||||
train.getRobotDriveParam().setStop(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 进路闭塞法行车
|
||||
*/
|
||||
public void routeBlockDrive(Simulation simulation, String groupNumber) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
if (!train.isAMMode()) {
|
||||
changePreselectionMode(train, PreselectionMode.AM_C);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开关门
|
||||
*/
|
||||
@ -561,19 +507,15 @@ public class ATPService {
|
||||
open = false;
|
||||
} else {
|
||||
Stand stand = standList.get(0);
|
||||
if (stand.isInside() && stand.isRight()) { // 内测
|
||||
if (stand.isRight()) { // 右站台,开1门
|
||||
if (stand.isInside() && stand.isRight()) { // 内测右站台,开1门
|
||||
doorIsRight = train.judgeDirection4DoorIsRight(train.getDoor1());
|
||||
} else { // 左站台,开2门
|
||||
} else if (stand.isInside() && !stand.isRight()) { // 内测左站台,开2门
|
||||
doorIsRight = train.judgeDirection4DoorIsRight(train.getDoor2());
|
||||
}
|
||||
} else { //外侧
|
||||
if (stand.isRight()) { // 右站台,开2门
|
||||
} else if (!stand.isInside() && stand.isRight()) { //外侧右站台,开2门
|
||||
doorIsRight = train.judgeDirection4DoorIsRight(train.getDoor2());
|
||||
} else { // 左站台,开1门
|
||||
} else {
|
||||
doorIsRight = train.judgeDirection4DoorIsRight(train.getDoor1());
|
||||
}
|
||||
}
|
||||
open = true;
|
||||
}
|
||||
VirtualRealityTrain.Door door = train.getDoorByDirection(doorIsRight);
|
||||
@ -603,26 +545,15 @@ public class ATPService {
|
||||
*/
|
||||
public void changePreselectionMode(Simulation simulation, String groupNumber, VirtualRealityTrain.PreselectionMode preselectionMode) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
// 检验条件
|
||||
operationVail(simulation,train);
|
||||
if (!train.isAtpOn()) {
|
||||
this.openAtp(train);
|
||||
}
|
||||
if (train.isSignalEB()) {
|
||||
this.releaseEB(train);
|
||||
}
|
||||
PreselectionMode trainMode = train.getPreselectionMode();
|
||||
if (trainMode != preselectionMode) { //预选级别不对
|
||||
changePreselectionMode(train, preselectionMode);
|
||||
} else if (trainMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
|
||||
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.ATO)) {
|
||||
this.changeGear(train, VirtualRealityTrain.Handwheel.ATO);
|
||||
}
|
||||
if (!train.isLeverInCoastingGear()) {
|
||||
this.changeTrainForce(train, 0F); // 改变列车的牵引
|
||||
}
|
||||
if (!train.isAtoOn()) {
|
||||
this.openATO(train);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -630,7 +561,9 @@ public class ATPService {
|
||||
*/
|
||||
public void applyNRM(Simulation simulation, String groupNumber) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
if (!train.isNRMMode()) {
|
||||
// 检验条件
|
||||
operationVail(simulation,train);
|
||||
while (!train.isNRMMode()) {
|
||||
this.cutOffAtp(train);
|
||||
}
|
||||
}
|
||||
@ -673,7 +606,12 @@ public class ATPService {
|
||||
* @param train 列车
|
||||
* @param preselectionMode 预选模式
|
||||
*/
|
||||
private void changePreselectionMode(VirtualRealityTrain train, PreselectionMode preselectionMode) {
|
||||
public void changePreselectionMode(VirtualRealityTrain train, PreselectionMode preselectionMode) {
|
||||
boolean loop = true;
|
||||
PreselectionMode trainMode = null;
|
||||
while (loop) {
|
||||
trainMode = train.getPreselectionMode();
|
||||
if (trainMode != preselectionMode) { //预选级别不对
|
||||
if (train.getPreselectionMode() != preselectionMode) {
|
||||
if (train.getTempPreselectionMode() != preselectionMode) {
|
||||
if (preselectionMode.isHigherThan(train.getTempPreselectionMode())) {
|
||||
@ -685,6 +623,20 @@ public class ATPService {
|
||||
this.confirmMessage(train);
|
||||
}
|
||||
}
|
||||
} else if (trainMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
|
||||
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.ATO)) {
|
||||
this.changeGear(train, VirtualRealityTrain.Handwheel.ATO);
|
||||
}
|
||||
if (!train.isLeverInCoastingGear()) {
|
||||
this.changeTrainForce(train, 0F); // 改变列车的牵引
|
||||
}
|
||||
if (!train.isAtoOn()) {
|
||||
this.openATO(train);
|
||||
}
|
||||
} else {
|
||||
loop = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseEB(VirtualRealityTrain train) {
|
||||
@ -698,4 +650,12 @@ public class ATPService {
|
||||
changePreselectionMode(train, PreselectionMode.RM);
|
||||
}
|
||||
}
|
||||
|
||||
private void operationVail(Simulation simulation,VirtualRealityTrain train){
|
||||
boolean driverRobot = simulation.getSimulationMembers().stream()
|
||||
.filter(simulationMember -> simulationMember.isDriver()
|
||||
&& train.getCode().equals(simulationMember.getDevice().getCode()))
|
||||
.anyMatch(SimulationMember::isRobot);
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotTrue(!driverRobot,"成员由用户扮演,操作不执行");
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,9 @@ public class DriveParamVO {
|
||||
public static final int NO = 0;
|
||||
public static final int RED_SIGNAL = 1;
|
||||
public static final int GUIDE_SIGNAL = 2;
|
||||
public static final int DRIVER_NEXT_STAND = 3;
|
||||
public static final int DRIVER_ROUTE_BLOCK = 4;
|
||||
|
||||
/**
|
||||
* 要越过的信号机
|
||||
*/
|
||||
@ -106,4 +109,14 @@ public class DriveParamVO {
|
||||
public boolean isThroughGuideSignal() {
|
||||
return GUIDE_SIGNAL == through;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isDriverNextStand() {
|
||||
return DRIVER_NEXT_STAND == through;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isRouteBlockDriver() {
|
||||
return DRIVER_ROUTE_BLOCK == through;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user