修改道岔转动问题;增加列车调度操作
This commit is contained in:
parent
04be3cda30
commit
3ad5509840
@ -0,0 +1,7 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class AtsMessage {
|
||||
private LocalDateTime time;
|
||||
}
|
@ -71,6 +71,8 @@ public class OperateMethod {
|
||||
args[i] = enumConstant;
|
||||
}
|
||||
}
|
||||
} else if (Map.class.isAssignableFrom(parameter.getType())) {
|
||||
args[i] = JsonUtils.read(JsonUtils.writeValueAsString(param.get(parameter.getName())), parameter.getType());
|
||||
} else {
|
||||
args[i] = JsonUtils.read(JsonUtils.writeValueAsString(param), parameter.getType());
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class StandOperateHandler {
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Stand_Set_Run_Time)
|
||||
public void setRunTime(Simulation simulation, String standCode, int runLevelTime, boolean runLevelTimeForever) {
|
||||
atsStandService.setRunTime(simulation, standCode, runLevelTime, runLevelTimeForever);
|
||||
atsStandService.setRunTime(simulation, standCode, runLevelTime, runLevelTimeForever, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.constants.BusinessConsts;
|
||||
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.ATS.operation.vo.RegulationParam;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.TrainTypeUpdateParam;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainLoadService;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainService;
|
||||
@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@OperateHandler
|
||||
@ -383,7 +385,7 @@ public class TrainOperateHandler {
|
||||
}
|
||||
|
||||
@OperateHandlerMapping(type = Operation.Type.Train_Regulation)
|
||||
public void regulation(Simulation simulation, String groupNumber, BusinessConsts.Regulation regulation) {
|
||||
|
||||
public void regulation(Simulation simulation, String groupNumber, BusinessConsts.Regulation regulation, RegulationParam regulationParam) {
|
||||
atsTrainService.regulation(simulation, groupNumber, regulation, regulationParam);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.operation.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 列车调度参数
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class RegulationParam {
|
||||
/**
|
||||
* 列车停站时间
|
||||
* k - standCode
|
||||
*/
|
||||
private Map<String, Integer> parkTimeMap;
|
||||
|
||||
/**
|
||||
* 列车区间运行时间
|
||||
* k - standCode
|
||||
*/
|
||||
private Map<String, Integer> runTimeMap;
|
||||
|
||||
/**
|
||||
* 列车跳停/不跳
|
||||
* k - standCode
|
||||
*/
|
||||
private Map<String, Boolean> skipMap;
|
||||
}
|
@ -22,6 +22,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -241,6 +242,7 @@ public class AtsStandService {
|
||||
stand.addTrainParkingTime(groupNumber, parkingTime);
|
||||
} else {
|
||||
stand.setParkingTime(parkingTime);
|
||||
stand.clearTrainParkingTime();
|
||||
}
|
||||
stand.setParkingAlwaysValid(parkingAlwaysValid);
|
||||
}
|
||||
@ -248,9 +250,13 @@ public class AtsStandService {
|
||||
/**
|
||||
* 设置站间运行等级
|
||||
*/
|
||||
public void setRunTime(Simulation simulation, String standCode, int level, boolean alwaysValid) {
|
||||
public void setRunTime(Simulation simulation, String standCode, int level, boolean alwaysValid, String groupNumber) {
|
||||
Stand stand = getStand(simulation, standCode);
|
||||
stand.setRunLevelTime(level);
|
||||
if (StringUtils.hasText(groupNumber)) {
|
||||
stand.addTrainRunTime(groupNumber, level);
|
||||
} else {
|
||||
stand.setRunLevelTime(level);
|
||||
}
|
||||
stand.setRunLevelTimeForever(alwaysValid);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.service;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.RegulationParam;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.service.stage.AtsHeadTrainStageService;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.service.stage.AtsPlanTrainStageService;
|
||||
import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
|
||||
@ -946,4 +948,71 @@ public class AtsTrainService {
|
||||
TrainInfo trainInfo = simulation.getRepository().getSupervisedTrainByGroup(groupNumber);
|
||||
trainInfo.setAtsAutoTrigger(autoTrigger);
|
||||
}
|
||||
|
||||
public void regulation(Simulation simulation, String groupNumber, BusinessConsts.Regulation regulation, RegulationParam regulationParam) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
switch (regulation) {
|
||||
case TIME_TABLE_REGULATION: {
|
||||
if (StringUtils.hasText(groupNumber)) {
|
||||
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(groupNumber);
|
||||
trainInfo.setAtsAutoAdjust(true);
|
||||
} else {
|
||||
repository.getSuperviseTrainList().forEach(trainInfo ->
|
||||
trainInfo.setAtsAutoAdjust(true));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HEADWAY_REGULATION_FRONT:
|
||||
break;
|
||||
case HEADWAY_REGULATION_FRONT_AND_BACK:
|
||||
break;
|
||||
case REGULATION_OFF: {
|
||||
if (StringUtils.hasText(groupNumber)) {
|
||||
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(groupNumber);
|
||||
trainInfo.setAtsAutoAdjust(false);
|
||||
} else {
|
||||
repository.getSuperviseTrainList().forEach(trainInfo ->
|
||||
trainInfo.setAtsAutoAdjust(false));
|
||||
}
|
||||
if (regulationParam == null)
|
||||
break;
|
||||
if (!CollectionUtils.isEmpty(regulationParam.getParkTimeMap())) {
|
||||
regulationParam.getParkTimeMap().forEach((k, v) -> {
|
||||
atsStandService.setParkTime(simulation, k, v, true, groupNumber);
|
||||
});
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(regulationParam.getRunTimeMap())) {
|
||||
regulationParam.getRunTimeMap().forEach((k, v) -> {
|
||||
atsStandService.setRunTime(simulation, k, v, true, groupNumber);
|
||||
});
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(regulationParam.getSkipMap())) {
|
||||
regulationParam.getSkipMap().forEach((k, v) -> {
|
||||
if (StringUtils.hasText(groupNumber)) {
|
||||
Stand stand = repository.getByCode(k, Stand.class);
|
||||
if (v) {
|
||||
if (!stand.isAllSkip()) {
|
||||
atsStandService.setJumpStop(simulation, k, groupNumber);
|
||||
}
|
||||
} else {
|
||||
if (stand.isAllSkip()) {
|
||||
atsStandService.cancelJumpStop(simulation, k, null);
|
||||
repository.getAllVrTrain().forEach(train ->
|
||||
atsStandService.setJumpStop(simulation, k, train.getGroupNumber()));
|
||||
}
|
||||
atsStandService.cancelJumpStop(simulation, k, groupNumber);
|
||||
}
|
||||
} else {
|
||||
if (v) {
|
||||
atsStandService.setJumpStop(simulation, k, null);
|
||||
} else {
|
||||
atsStandService.cancelJumpStop(simulation, k, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,6 @@ public class CiApiServiceImpl implements CiApiService {
|
||||
public void turn(Simulation simulation, String switchCode) {
|
||||
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
||||
boolean toNormal = aSwitch.judgeTurnToNormal();
|
||||
aSwitch.setLastTurnToNormal(toNormal);
|
||||
if (toNormal) {
|
||||
if (!this.switchService.turn2NormalPosition(simulation, aSwitch)) {
|
||||
log.info(String.format("道岔[%s(%s)]锁闭,不能进行定操", aSwitch.getName(), aSwitch.getCode()));
|
||||
|
@ -121,6 +121,9 @@ public class Stand extends MayOutOfOrderDevice {
|
||||
*/
|
||||
private int runLevelTime;
|
||||
|
||||
/** 列车-停站时间map */
|
||||
private final Map<String, Integer> runTimeMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 区间运行时间是否一直有效
|
||||
*/
|
||||
@ -345,6 +348,14 @@ public class Stand extends MayOutOfOrderDevice {
|
||||
this.parkingTimeMap.clear();
|
||||
}
|
||||
|
||||
public void addTrainRunTime(String groupNumber, int runLevelTime) {
|
||||
this.runTimeMap.put(groupNumber, runLevelTime);
|
||||
}
|
||||
|
||||
public void clearTrainRunTime() {
|
||||
this.runTimeMap.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 站台折返类型策略
|
||||
*/
|
||||
|
@ -144,11 +144,6 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
*/
|
||||
private boolean init;
|
||||
|
||||
/**
|
||||
* 上一次是否是将道岔转向定位
|
||||
*/
|
||||
private Boolean lastTurnToNormal;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
@ -170,7 +165,6 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
this.interlockReserve = false;
|
||||
this.blockadeInvalid = false;
|
||||
this.init = false;
|
||||
this.lastTurnToNormal = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,11 +436,8 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
} else if (this.normalPosition) {
|
||||
toNormal = false;
|
||||
} else {
|
||||
if (this.lastTurnToNormal != null) {
|
||||
toNormal = !this.lastTurnToNormal;
|
||||
} else {
|
||||
toNormal = true;
|
||||
}
|
||||
VirtualRealitySwitch virtualSwitch = this.virtualSwitch;
|
||||
return !virtualSwitch.isToNormal();
|
||||
}
|
||||
return toNormal;
|
||||
}
|
||||
|
@ -266,6 +266,10 @@ public class TrainInfo extends MapElement {
|
||||
/** 通信是否正常 */
|
||||
private boolean communicable;
|
||||
|
||||
/** ats自动调整 */
|
||||
@Setter
|
||||
private boolean atsAutoAdjust = true;
|
||||
|
||||
public TrainInfo(String groupNumber) {
|
||||
super(groupNumber, DeviceType.TRAIN);
|
||||
this.groupNumber = groupNumber;
|
||||
@ -616,10 +620,6 @@ public class TrainInfo extends MapElement {
|
||||
return !Stand.TurnBackType.DEFAULT.name().equals(this.turnBackStrategy);
|
||||
}
|
||||
|
||||
public boolean isManual() {
|
||||
return TrainType.MANUAL.equals(getType());
|
||||
}
|
||||
|
||||
public void turnBackInit(Section lastRouteSection) {
|
||||
this.turnBack = true;
|
||||
this.turnBackStatus = INIT;
|
||||
|
@ -65,6 +65,7 @@ public class VirtualRealitySwitch extends VirtualRealityDevice {
|
||||
this.setting = false;
|
||||
this.remainTime = null;
|
||||
this.timeoutRemain = 0;
|
||||
this.toNormal = this.normal;
|
||||
this.fault = null;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class RobotLogicLoop {
|
||||
switch (train.getDriveMode()) {
|
||||
case AM: //AM模式下不需要司机驾驶
|
||||
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
|
||||
if (trainInfo.isManual()) {
|
||||
if (trainInfo.isManualTrain()) {
|
||||
train.setTarget(train.getRobotTargetPosition().getSection());
|
||||
train.setRobotTargetPosition(null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user