添加浙大网新停车/发车操作指令
This commit is contained in:
parent
dd1e5b7705
commit
b02db4209e
@ -356,6 +356,10 @@ public class Operation {
|
||||
Train_Set_Route,
|
||||
/** 设置运行类型 */
|
||||
Train_Set_Run_Type,
|
||||
/** 下令停车 */
|
||||
Train_Order_Stop,
|
||||
/** 取消停车命令 */
|
||||
Train_Cancel_Order_Stop,
|
||||
|
||||
//--------------------------- 司机 ---------------------------
|
||||
/** 改变列车的牵引/制动力 */
|
||||
|
@ -333,4 +333,14 @@ public class TrainOperateHandler {
|
||||
public void setRunType(Simulation simulation, String groupNumber, VirtualRealityTrain.RunType runType) {
|
||||
atsTrainService.setRunType(simulation, groupNumber, runType);
|
||||
}
|
||||
|
||||
@OperateHandlerMapping(type = Operation.Type.Train_Order_Stop)
|
||||
public void orderStop(Simulation simulation) {
|
||||
atsTrainService.orderStop(simulation);
|
||||
}
|
||||
|
||||
@OperateHandlerMapping(type = Operation.Type.Train_Cancel_Order_Stop)
|
||||
public void cancelOrderStop(Simulation simulation) {
|
||||
atsTrainService.cancelOrderStop(simulation);
|
||||
}
|
||||
}
|
||||
|
@ -832,4 +832,18 @@ public class AtsTrainService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 下令停车
|
||||
*/
|
||||
public void orderStop(Simulation simulation) {
|
||||
simulation.getRepository().getOnlineTrainList().forEach(train -> train.setOrderStop(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消停车命令
|
||||
*/
|
||||
public void cancelOrderStop(Simulation simulation) {
|
||||
simulation.getRepository().getOnlineTrainList().forEach(train -> train.setOrderStop(false));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.status;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.PlanRoutingType;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
||||
@ -10,6 +9,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainStatusVO;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -103,6 +103,8 @@ public class TrainStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean backUp;
|
||||
|
||||
private boolean orderStop;
|
||||
|
||||
public TrainStatus(TrainInfo train) {
|
||||
super(train.getGroupNumber(), MapElement.DeviceType.TRAIN);
|
||||
this.groupNumber = train.getGroupNumber();
|
||||
@ -128,6 +130,7 @@ public class TrainStatus extends DeviceStatus {
|
||||
this.hold = train.isHold();
|
||||
this.dt = train.getDt();
|
||||
this.backUp = train.isBackUp();
|
||||
this.orderStop = train.isOrderStop();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,6 +246,11 @@ public class TrainStatus extends DeviceStatus {
|
||||
status.setDt(this.dt);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.orderStop, train.isOrderStop())) {
|
||||
this.orderStop = train.isOrderStop();
|
||||
status.setOrderStop(this.orderStop);
|
||||
change = true;
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,9 @@ public class TrainInfo extends MapElement {
|
||||
@Setter
|
||||
private List<Section> headPath;
|
||||
|
||||
/** 下令停车 */
|
||||
private boolean orderStop;
|
||||
|
||||
public TrainInfo(String groupNumber) {
|
||||
super(groupNumber, DeviceType.TRAIN);
|
||||
this.groupNumber = groupNumber;
|
||||
@ -253,6 +256,7 @@ public class TrainInfo extends MapElement {
|
||||
this.hold = train.isHold();
|
||||
this.priorityRouteSet = train.isHold();
|
||||
this.backUp = train.isBackUp();
|
||||
this.orderStop = train.isOrderStop();
|
||||
}
|
||||
|
||||
public boolean isCbtcTrack() {
|
||||
|
@ -1,13 +1,13 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.PlanRoutingType;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.TrainType;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@ -102,6 +102,9 @@ public class TrainStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean backUp;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean orderStop;
|
||||
|
||||
public TrainStatusVO(TrainInfo train) {
|
||||
super(train.getGroupNumber(), MapElement.DeviceType.TRAIN);
|
||||
}
|
||||
|
@ -378,6 +378,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
*/
|
||||
private RunType runType;
|
||||
|
||||
/**
|
||||
* 下令停车
|
||||
*/
|
||||
private boolean orderStop;
|
||||
|
||||
public void setRunType(RunType runType) {
|
||||
this.runType = runType;
|
||||
switch (runType) {
|
||||
|
@ -75,6 +75,10 @@ public class ATOService {
|
||||
if (!train.isPowerOn() || !train.isAtoOn()) {
|
||||
return;
|
||||
}
|
||||
//下令停车
|
||||
if (train.isOrderStop()) {
|
||||
this.doBreakMax(train);
|
||||
}
|
||||
// 计算到目标/授权终点剩余距离,根据距离计算速度,根据速度,控制牵引/制动输出
|
||||
MovementAuthority ma = train.getMa();
|
||||
if (Objects.isNull(ma)) {
|
||||
|
@ -7,6 +7,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
public class DestinationCodeVO {
|
||||
@ -19,8 +20,14 @@ public class DestinationCodeVO {
|
||||
public DestinationCodeVO(DestinationCodeDefinition definition) {
|
||||
this.code = definition.getCode();
|
||||
this.description = definition.getDescription();
|
||||
if (!CollectionUtils.isEmpty(runPath)) {
|
||||
this.runPath = definition.getRunPath().stream().map(MapElement::getCode).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(definition.getRunPath())) {
|
||||
this.runPath = definition.getRunPath().stream().flatMap(section -> {
|
||||
if (!CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
return section.getLogicList().stream();
|
||||
} else {
|
||||
return Stream.of(section);
|
||||
}
|
||||
}).map(MapElement::getCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user