南京操作
This commit is contained in:
parent
68ebd521d8
commit
39ab1f9c0b
@ -5,9 +5,11 @@ import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
|
||||
import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO;
|
||||
@ -15,15 +17,17 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@GeneratorSelectorNew(operateObject = Operation.Object.Station)
|
||||
public class StationGeneratorNew implements GeneratorNew {
|
||||
@Autowired
|
||||
private DeviceStatusModifyTool deviceStatusModifyTool;
|
||||
|
||||
@Autowired
|
||||
private AtsOperationDispatcher atsOperationDispatcher;
|
||||
|
||||
@Override
|
||||
public List<TrainingNewVO> generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) {
|
||||
List<TrainingNewVO> trainingVOList = new ArrayList<>();
|
||||
@ -238,7 +242,7 @@ public class StationGeneratorNew implements GeneratorNew {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Station_Restart:
|
||||
case Station_Restart: {
|
||||
if(!station.isInterlock())continue;
|
||||
if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())) {
|
||||
if(station.isCentralized()) {
|
||||
@ -247,12 +251,23 @@ public class StationGeneratorNew implements GeneratorNew {
|
||||
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
|
||||
}
|
||||
}
|
||||
SimulationMember member = new SimulationMember("", SimulationMember.Type.DISPATCHER, null);
|
||||
String operate = Operation.Type.Station_Restart_Interlock_Machine.name();
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("stationCode", station.getCode());
|
||||
atsOperationDispatcher.execute(simulation, member, operate, param);
|
||||
station.setInterlockMachineStarting(true);
|
||||
break;
|
||||
case Station_Release:
|
||||
}
|
||||
case Station_Release: {
|
||||
if(!station.isInterlock())continue;
|
||||
Station.Fault.INTERLOCK_FAULT.apply(station);
|
||||
SimulationMember member = new SimulationMember("", SimulationMember.Type.DISPATCHER, null);
|
||||
String operate = Operation.Type.Server_ATP_Restart.name();
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
atsOperationDispatcher.execute(simulation, member, operate, param);
|
||||
station.setInterlockMachineStarting(true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// 其他操作,不生成
|
||||
continue;
|
||||
|
@ -431,6 +431,10 @@ public class Operation {
|
||||
RunPlan_Add_Trip,
|
||||
/** 删除计划 */
|
||||
RunPlan_Delete_Trip,
|
||||
|
||||
//--------------------------- 服务器 ---------------------------
|
||||
/** ATP系统重启 */
|
||||
Server_ATP_Restart
|
||||
}
|
||||
|
||||
/**操作对象枚举*/
|
||||
|
@ -43,6 +43,9 @@ public class FaultOperateHandler {
|
||||
@Autowired
|
||||
private StationFaultService stationFaultService;
|
||||
|
||||
@Autowired
|
||||
private ServerFaultService serverFaultService;
|
||||
|
||||
/**
|
||||
* 设备设置故障
|
||||
*
|
||||
@ -155,6 +158,13 @@ public class FaultOperateHandler {
|
||||
}
|
||||
catenaryFaultService.fixFault(simulation, mayOutOfOrderDevice, param);
|
||||
return;
|
||||
case SERVER:
|
||||
if (isSet) {
|
||||
serverFaultService.setFault(simulation, mayOutOfOrderDevice, param);
|
||||
} else {
|
||||
serverFaultService.fixFault(simulation, mayOutOfOrderDevice, param);
|
||||
}
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.operation.handler;
|
||||
|
||||
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.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Server;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@OperateHandler
|
||||
public class ServerOperateHandle {
|
||||
@OperateHandlerMapping(type = Operation.Type.Server_ATP_Restart)
|
||||
public void atpRestart(Simulation simulation) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
repository.getSectionList().forEach(section -> {
|
||||
section.setSpeedLimitBeforeFault(section.getSpeedUpLimit());
|
||||
section.setSpeedUpLimit(5);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.operation.service;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.FaultParam;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Server;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.StatusDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceFaultOverEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceFaultSetEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ServerFaultService implements DeviceFaultService{
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setFault(Simulation simulation, MayOutOfOrderDevice device, FaultParam param) {
|
||||
Server.Fault deviceFault = checkAndGetFault(param);
|
||||
boolean apply = deviceFault.apply(device);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
switch (deviceFault) {
|
||||
case ATP_FAULT:
|
||||
repository.getSectionList().forEach(section -> {
|
||||
section.setSpeedLimitBeforeFault(section.getSpeedUpLimit());
|
||||
section.setSpeedUpLimit(5);
|
||||
});
|
||||
break;
|
||||
case ATS_FAULT:
|
||||
List<StatusDevice> statusDevices = repository.getStatusDevices();
|
||||
statusDevices.forEach(statusDevice -> statusDevice.setAtsNoStatus(true));
|
||||
break;
|
||||
}
|
||||
if (apply) {
|
||||
this.applicationContext.publishEvent(new SimulationDeviceFaultSetEvent(this,
|
||||
simulation, new DeviceFaultInfo(device.getCode(), device.getDeviceType(), deviceFault)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixFault(Simulation simulation, MayOutOfOrderDevice device, FaultParam param) {
|
||||
Server.Fault fault = checkAndGetFault(param);
|
||||
fault.fix(device);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
switch (fault) {
|
||||
case ATP_FAULT:
|
||||
break;
|
||||
case ATS_FAULT:
|
||||
List<StatusDevice> statusDevices = repository.getStatusDevices();
|
||||
statusDevices.forEach(statusDevice -> statusDevice.setAtsNoStatus(false));
|
||||
break;
|
||||
}
|
||||
this.applicationContext.publishEvent(new SimulationDeviceFaultOverEvent(this,
|
||||
simulation, new DeviceFaultInfo(device.getCode(), device.getDeviceType(), fault)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server.Fault checkAndGetFault(FaultParam param) {
|
||||
return Server.Fault.valueOf(param.getFaultType());
|
||||
}
|
||||
}
|
@ -514,7 +514,17 @@ public class AtsStationService {
|
||||
}
|
||||
station.setInterlockMachineStarting(true);
|
||||
station.setRestartTime(LocalTime.now());
|
||||
Station.Fault.INTERLOCK_FAULT.fix(station);
|
||||
Station.Fault.INTERLOCK_FAULT.fix(station); //恢复联锁机故障
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
for (StatusDevice value : station.getDeviceMap().values()) {
|
||||
if (value instanceof Section) { //联锁区所有区段故障锁闭
|
||||
Section section = (Section) value;
|
||||
section.recursivelySetFaultLock(true);
|
||||
} else if (value instanceof Station) { //联锁区所有车站交出控制权
|
||||
Station station1 = (Station) value;
|
||||
station1.setControlMode(Station.ControlMode.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void openAutoSetting(Simulation simulation, String stationCode) {
|
||||
|
@ -95,6 +95,12 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
log.info(String.format("道岔[%s(%s)]锁闭,不能转动", aSwitch.getName(), aSwitch.getCode()));
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "道岔锁闭,不能进行定操");
|
||||
}
|
||||
if (Switch.SwitchFault.SPLIT_4.equals(aSwitch.getFault())) {
|
||||
int times = aSwitch.getTurnTimes().incrementAndGet();
|
||||
if (times == 4) {
|
||||
Switch.SwitchFault.SPLIT_4.fix(aSwitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -465,11 +471,21 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
deviceStation = station.getDeviceStation();
|
||||
}
|
||||
deviceStation.setInterlockMachineStarting(false);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
repository.getSectionList().forEach(section -> section.setFaultLock(false)); //所有区段取消故障锁闭
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release(Simulation simulation, Station station) {
|
||||
|
||||
for (Section section : simulation.getRepository().getSectionList()) {
|
||||
Integer speedLimitBeforeFault = section.getSpeedLimitBeforeFault();
|
||||
if (speedLimitBeforeFault != null) {
|
||||
section.setSpeedUpLimit(speedLimitBeforeFault);
|
||||
section.setSpeedLimitBeforeFault(null);
|
||||
}
|
||||
}
|
||||
Server server = simulation.getRepository().getByCode(Server.CODE, Server.class);
|
||||
Server.Fault.ATP_FAULT.fix(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -521,7 +537,7 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(axleSection != null && axleSection.isAxleCounter(),
|
||||
section.debugStr() + "不是计轴区段也不归属于任何计轴区段");
|
||||
VirtualRealitySectionAxleCounter virtualAxleCounter = axleSection.getVirtualAxleCounter();
|
||||
if (!virtualAxleCounter.isOccupy()){
|
||||
if (!virtualAxleCounter.isOccupy()) {
|
||||
VirtualRealitySectionAxleCounter.Fault.FAULT.apply(virtualAxleCounter);
|
||||
Section.AxleFault.ARB.apply(axleSection);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class CiDeviceStatusCollector {
|
||||
private void collectPsd(SimulationDataRepository repository, List<PSD> psdList) {
|
||||
for (PSD psd : psdList) {
|
||||
VirtualRealityScreenDoor vrPsd = psd.getVirtualScreenDoor();
|
||||
if (vrPsd != null) {
|
||||
if (psd.isNoStatus() || vrPsd != null) {
|
||||
psd.apply(vrPsd.isClose(), vrPsd.isLock(), vrPsd.isInterlockRelease());
|
||||
}
|
||||
}
|
||||
|
@ -164,6 +164,11 @@ public class CiService {
|
||||
}
|
||||
}
|
||||
level = Signal.LEVEL_Guide; // 引导级
|
||||
Signal signal = route.getStart();
|
||||
if (Signal.SignalFault.JZJTS.equals(signal.getFault())
|
||||
|| (!signal.isCbtcMode() && Signal.SignalFault.LIGHTING_UNIT_FAULT_NAME.equals(signal.getFault()))
|
||||
|| (!signal.isCbtcMode() && Signal.SignalFault.LIGHTING_UNIT_FAULT_HEAD.equals(signal.getFault())))
|
||||
return level;
|
||||
// 进路侧防检查
|
||||
List<RouteFls> flsList = route.getFlsList();
|
||||
if (!CollectionUtils.isEmpty(flsList)) {
|
||||
@ -231,7 +236,7 @@ public class CiService {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (route.getStart().isCbtcMode()) {
|
||||
if (signal.isCbtcMode()) {
|
||||
level = Signal.LEVEL_Atp; // ATP级
|
||||
}
|
||||
// 区段占用检查
|
||||
|
@ -30,6 +30,9 @@ public class MapDeviceBuilder {
|
||||
Map<String, MapElement> elementMap = mapDataBuildResult.getDeviceMap();
|
||||
Map<String, VirtualRealityDevice> deviceMap = mapDataBuildResult.getVrDeviceMap();
|
||||
List<String> errMsgList = mapDataBuildResult.getErrMsgList();
|
||||
// server
|
||||
Server server = new Server();
|
||||
elementMap.put(server.getCode(), server);
|
||||
// ZC
|
||||
List<MapZcVO> zcList = graphData.getZcList();
|
||||
zcList.forEach(mapZcVO -> {
|
||||
|
@ -1187,4 +1187,11 @@ public class SimulationDataRepository {
|
||||
.assertNotNull(vrPsl, String.format("%s无对应的vrPsl", vrPsd.debugStr()));
|
||||
return vrPsl;
|
||||
}
|
||||
|
||||
public List<StatusDevice> getStatusDevices() {
|
||||
return deviceMap.values().stream()
|
||||
.filter(device -> device instanceof StatusDevice)
|
||||
.map(device -> (StatusDevice) device)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ public abstract class MapElement {
|
||||
IBP,
|
||||
/** 就地控制盘 */
|
||||
PSL,
|
||||
/** 服务器 */
|
||||
SERVER,
|
||||
}
|
||||
|
||||
/** 设备唯一编号 */
|
||||
|
@ -41,7 +41,12 @@ public abstract class MayOutOfOrderDevice extends StatusDevice {
|
||||
@JsonSubTypes.Type(value = ZC.Fault.class, name = "ZC$Fault$1")
|
||||
})
|
||||
public interface DeviceFault {
|
||||
boolean apply(MayOutOfOrderDevice device);
|
||||
default boolean apply(MayOutOfOrderDevice device) {
|
||||
if (this.equals(device.getFault()))
|
||||
return false;
|
||||
device.setFault(this);
|
||||
return true;
|
||||
};
|
||||
|
||||
default void fix(MayOutOfOrderDevice device) {
|
||||
if (this.equals(device.fault))
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.map;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
@ -219,6 +220,11 @@ public class Section extends DelayUnlockDevice {
|
||||
*/
|
||||
private int speedUpLimit = -1;
|
||||
|
||||
/**
|
||||
* ATP故障前的限速
|
||||
*/
|
||||
private Integer speedLimitBeforeFault;
|
||||
|
||||
/**
|
||||
* 延时解锁
|
||||
*/
|
||||
@ -253,6 +259,7 @@ public class Section extends DelayUnlockDevice {
|
||||
this.invalid = false;
|
||||
this.faultLock = false;
|
||||
this.speedUpLimit = -1;
|
||||
this.speedLimitBeforeFault = null;
|
||||
this.delayUnlock = false;
|
||||
this.closeInit = false;
|
||||
this.openInit = false;
|
||||
@ -1085,6 +1092,13 @@ public class Section extends DelayUnlockDevice {
|
||||
}
|
||||
}
|
||||
|
||||
public Section getAxleCounterSection() {
|
||||
Section axleSection = findAxleCounterSection();
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(axleSection,
|
||||
this.debugStr() + "无归属计轴区段");
|
||||
return axleSection;
|
||||
}
|
||||
|
||||
public boolean isAheadOf(SimulationDataRepository repository, Section other, boolean right) {
|
||||
List<RoutePath> routePaths = repository.queryRoutePathsByEndAndContainsSection(this, other);
|
||||
if (CollectionUtils.isEmpty(routePaths))
|
||||
@ -1208,6 +1222,36 @@ public class Section extends DelayUnlockDevice {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseStatus() {
|
||||
setNoStatus(true);
|
||||
if (!CollectionUtils.isEmpty(this.getLogicList())) {
|
||||
for (Section section : this.getLogicList()) {
|
||||
section.loseStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreStatus() {
|
||||
setNoStatus(false);
|
||||
if (!CollectionUtils.isEmpty(this.getLogicList())) {
|
||||
for (Section section : this.getLogicList()) {
|
||||
section.restoreStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归地设置故障锁闭
|
||||
*/
|
||||
public void recursivelySetFaultLock(boolean faultLock) {
|
||||
this.setFaultLock(faultLock);
|
||||
if (!CollectionUtils.isEmpty(this.logicList)) {
|
||||
logicList.forEach(section -> section.recursivelySetFaultLock(faultLock));
|
||||
}
|
||||
}
|
||||
|
||||
public enum SectionRoadType {
|
||||
/**
|
||||
* 左行线
|
||||
@ -1270,17 +1314,27 @@ public class Section extends DelayUnlockDevice {
|
||||
},
|
||||
|
||||
/**
|
||||
* 无法从真实设备采集状态(哈尔滨灰显)【可能没用了】
|
||||
* 无法从真实设备采集状态(哈尔滨灰显)
|
||||
*/
|
||||
UNABLE_COLLECT_STATUS {
|
||||
@Override
|
||||
public boolean apply(MayOutOfOrderDevice device) {
|
||||
Section section = (Section) device;
|
||||
if (this.equals(section.getFault()))
|
||||
Section axleSection = section.getAxleCounterSection();
|
||||
if (this.equals(axleSection.getFault()))
|
||||
return false;
|
||||
section.setFault(this);
|
||||
axleSection.setFault(this);
|
||||
axleSection.loseStatus();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fix(MayOutOfOrderDevice device) {
|
||||
super.fix(device);
|
||||
Section section = (Section) device;
|
||||
Section axleSection = section.getAxleCounterSection();
|
||||
axleSection.restoreStatus();
|
||||
}
|
||||
},
|
||||
|
||||
CBTC_OCCUPIED_FAULT {
|
||||
|
@ -0,0 +1,21 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.map;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 服务器
|
||||
*/
|
||||
@Getter
|
||||
public class Server extends MayOutOfOrderDevice{
|
||||
|
||||
public static final String CODE = "Server";
|
||||
|
||||
public Server() {
|
||||
super(CODE, CODE, DeviceType.SERVER);
|
||||
}
|
||||
|
||||
public enum Fault implements DeviceFault{
|
||||
ATP_FAULT,
|
||||
ATS_FAULT,
|
||||
}
|
||||
}
|
@ -694,7 +694,19 @@ public class Signal extends DelayUnlockDevice {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
},
|
||||
/**
|
||||
* 机柱机头闪(信号机最多只能到引导级)
|
||||
*/
|
||||
JZJTS,
|
||||
/**
|
||||
* 轨旁无线服务器故障-点灯单元故障(CTC级别“正常”(不知道怎么算不正常)无影响,非CTC级别只能到引导级)
|
||||
*/
|
||||
//信号机编号闪
|
||||
LIGHTING_UNIT_FAULT_NAME,
|
||||
//机头闪
|
||||
LIGHTING_UNIT_FAULT_HEAD,
|
||||
;
|
||||
|
||||
@Override
|
||||
public void fix(MayOutOfOrderDevice device) {
|
||||
|
@ -550,7 +550,7 @@ public class Station extends MayOutOfOrderDevice {
|
||||
station = station.getDeviceStation();
|
||||
}
|
||||
for (StatusDevice statusDevice : station.deviceMap.values()) {
|
||||
statusDevice.setNoStatus(true);
|
||||
statusDevice.loseStatus();
|
||||
}
|
||||
if (Objects.equals(this, station.getFault())) {
|
||||
return false;
|
||||
@ -568,7 +568,7 @@ public class Station extends MayOutOfOrderDevice {
|
||||
if (!Objects.equals(this, device.getFault()))
|
||||
return;
|
||||
for (StatusDevice statusDevice : station.deviceMap.values()) {
|
||||
statusDevice.setNoStatus(false);
|
||||
statusDevice.restoreStatus();
|
||||
}
|
||||
station.setFault(null);
|
||||
}
|
||||
|
@ -9,11 +9,23 @@ public abstract class StatusDevice extends MapNamedElement {
|
||||
/** 无状态(灰显) */
|
||||
private boolean noStatus;
|
||||
|
||||
/** 行调界面无状态 */
|
||||
private boolean atsNoStatus;
|
||||
|
||||
protected StatusDevice(String code, String name, DeviceType deviceType) {
|
||||
super(code, name, deviceType);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.noStatus = false;
|
||||
this.atsNoStatus = false;
|
||||
}
|
||||
|
||||
public void loseStatus() {
|
||||
setNoStatus(true);
|
||||
}
|
||||
|
||||
public void restoreStatus() {
|
||||
setNoStatus(false);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -132,6 +133,11 @@ public class Switch extends DelayUnlockDevice {
|
||||
*/
|
||||
private Boolean lastTurnToNormal;
|
||||
|
||||
/**
|
||||
* 该道岔转动次数(仅在道岔应用了转动4次后恢复的故障时记录)
|
||||
*/
|
||||
private AtomicInteger turnTimes;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
@ -152,6 +158,7 @@ public class Switch extends DelayUnlockDevice {
|
||||
this.init = false;
|
||||
this.lastTurnToNormal = null;
|
||||
this.forceTurnRemain = 0;
|
||||
this.turnTimes = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -561,6 +568,23 @@ public class Switch extends DelayUnlockDevice {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 转动4次后恢复的失表故障
|
||||
*/
|
||||
SPLIT_4{
|
||||
@Override
|
||||
public boolean apply(MayOutOfOrderDevice device) {
|
||||
Switch aSwitch = (Switch) device;
|
||||
if (Objects.equals(aSwitch.getFault(), this)) {
|
||||
return false;
|
||||
}
|
||||
aSwitch.setFault(this);
|
||||
aSwitch.setPos(SwitchIndication.NO);
|
||||
aSwitch.setTurnTimes(new AtomicInteger(0));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 定位失表
|
||||
*/
|
||||
@ -657,6 +681,32 @@ public class Switch extends DelayUnlockDevice {
|
||||
Switch aSwitch = (Switch) device;
|
||||
Section.AxleFault.CBTC_OCCUPIED_FAULT.fix(aSwitch.getA());
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 道岔区段灰显
|
||||
*/
|
||||
SECTION_NO_STATUS {
|
||||
@Override
|
||||
public boolean apply(MayOutOfOrderDevice device) {
|
||||
boolean apply = super.apply(device);
|
||||
if (!apply)
|
||||
return false;
|
||||
Switch aSwitch = (Switch) device;
|
||||
aSwitch.loseStatus();
|
||||
aSwitch.getAllSections().forEach(Section::loseStatus);
|
||||
aSwitch.getA().getParent().loseStatus();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fix(MayOutOfOrderDevice device) {
|
||||
super.fix(device);
|
||||
Switch aSwitch = (Switch) device;
|
||||
aSwitch.restoreStatus();
|
||||
aSwitch.getAllSections().forEach(Section::restoreStatus);
|
||||
aSwitch.getA().getParent().restoreStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ public class PSDStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean atsNoStatus;
|
||||
|
||||
public PSDStatus(PSD psd) {
|
||||
super(psd.getCode(), psd.getDeviceType());
|
||||
this.close = psd.isCloseAndLock();
|
||||
@ -68,6 +71,11 @@ public class PSDStatus extends DeviceStatus {
|
||||
status.setNoStatus(noStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.atsNoStatus, psd.isAtsNoStatus())) {
|
||||
this.atsNoStatus = psd.isAtsNoStatus();
|
||||
status.setAtsNoStatus(atsNoStatus);
|
||||
change = true;
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@ -77,6 +85,7 @@ public class PSDStatus extends DeviceStatus {
|
||||
statusVO.setClose(close);
|
||||
statusVO.setInterlockRelease(interlockRelease);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setAtsNoStatus(atsNoStatus);
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.status;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.SectionStatusVO;
|
||||
@ -81,6 +82,12 @@ public class SectionStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean noStatus;
|
||||
|
||||
/**
|
||||
* ats无状态
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean atsNoStatus;
|
||||
|
||||
/**
|
||||
* 计轴预复位
|
||||
*/
|
||||
@ -108,6 +115,7 @@ public class SectionStatus extends DeviceStatus {
|
||||
this.faultLock = section.isFaultLock();
|
||||
this.speedUpLimit = section.getSpeedUpLimit();
|
||||
this.noStatus = section.isNoStatus();
|
||||
this.atsNoStatus = section.isAtsNoStatus();
|
||||
this.preReset = section.isPreReset();
|
||||
this.delayUnlock = section.isDelayUnlock();
|
||||
this.closed = section.isClosed();
|
||||
@ -174,6 +182,11 @@ public class SectionStatus extends DeviceStatus {
|
||||
status.setNoStatus(noStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.atsNoStatus, section.isAtsNoStatus())) {
|
||||
this.atsNoStatus = section.isAtsNoStatus();
|
||||
status.setAtsNoStatus(atsNoStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.preReset, section.isPreReset())) {
|
||||
this.preReset = section.isPreReset();
|
||||
status.setPreReset(this.preReset);
|
||||
@ -189,6 +202,12 @@ public class SectionStatus extends DeviceStatus {
|
||||
status.setClosed(this.closed);
|
||||
change = true;
|
||||
}
|
||||
String fault = section.getFault() == null ? null : section.getFault().toString();
|
||||
if (!Objects.equals(this.fault, fault)) {
|
||||
this.fault = fault;
|
||||
status.setFault(fault);
|
||||
change = true;
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@ -206,9 +225,11 @@ public class SectionStatus extends DeviceStatus {
|
||||
statusVO.setLockRight(lockRight);
|
||||
statusVO.setBlockade(blockade);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setAtsNoStatus(atsNoStatus);
|
||||
statusVO.setPreReset(preReset);
|
||||
statusVO.setDelayUnlock(delayUnlock);
|
||||
statusVO.setClosed(closed);
|
||||
statusVO.setFault(fault);
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,9 @@ public class SignalStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean atsNoStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean approachLock;
|
||||
|
||||
@ -74,6 +77,7 @@ public class SignalStatus extends DeviceStatus {
|
||||
this.aspect = signal.getAspect();
|
||||
this.remainTime = signal.getRemain();
|
||||
this.noStatus = signal.isNoStatus();
|
||||
this.atsNoStatus = signal.isAtsNoStatus();
|
||||
this.approachLock = signal.isApproachLock();
|
||||
this.overlapLock = signal.isOverlapLock();
|
||||
this.fault = Objects.nonNull(signal.getFault())?((Signal.SignalFault)signal.getFault()).name():null;
|
||||
@ -129,6 +133,11 @@ public class SignalStatus extends DeviceStatus {
|
||||
status.setNoStatus(noStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.atsNoStatus, signal.isAtsNoStatus())) {
|
||||
this.atsNoStatus = signal.isAtsNoStatus();
|
||||
status.setAtsNoStatus(this.atsNoStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.approachLock, signal.isApproachLock())) {
|
||||
this.approachLock = signal.isApproachLock();
|
||||
status.setApproachLock(approachLock);
|
||||
@ -163,6 +172,7 @@ public class SignalStatus extends DeviceStatus {
|
||||
statusVO.setReblockade(this.reblockade);
|
||||
statusVO.setLockedRouteCode(lockedRouteCode);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setAtsNoStatus(atsNoStatus);
|
||||
statusVO.setApproachLock(approachLock);
|
||||
statusVO.setOverlapLock(overlapLock);
|
||||
statusVO.setFault(fault);
|
||||
|
@ -85,6 +85,9 @@ public class StandStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean atsNoStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean closed;
|
||||
|
||||
@ -120,6 +123,7 @@ public class StandStatus extends DeviceStatus {
|
||||
this.parkingAlwaysValid = stand.isParkingAlwaysValid();
|
||||
this.typeStrategy = stand.getTypeStrategy();
|
||||
this.noStatus = stand.isNoStatus();
|
||||
this.atsNoStatus = stand.isAtsNoStatus();
|
||||
this.closed = stand.isClosed();
|
||||
this.fault = Objects.nonNull(stand.getFault())?((Stand.Fault)stand.getFault()).name():null;
|
||||
}
|
||||
@ -232,6 +236,11 @@ public class StandStatus extends DeviceStatus {
|
||||
status.setNoStatus(noStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.atsNoStatus, stand.isAtsNoStatus())) {
|
||||
this.atsNoStatus = stand.isAtsNoStatus();
|
||||
status.setAtsNoStatus(this.atsNoStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.closed, stand.isClosed())) {
|
||||
this.closed = stand.isClosed();
|
||||
status.setClosed(this.closed);
|
||||
@ -270,6 +279,7 @@ public class StandStatus extends DeviceStatus {
|
||||
statusVO.setTrainParking(trainParking);
|
||||
statusVO.setRemainTime(remainTime);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setAtsNoStatus(atsNoStatus);
|
||||
statusVO.setClosed(closed);
|
||||
statusVO.setFault(fault);
|
||||
return statusVO;
|
||||
|
@ -74,6 +74,8 @@ public class StationStatus extends DeviceStatus {
|
||||
*/
|
||||
private int preResetValidDuration;
|
||||
|
||||
private boolean interlockMachineStarting;
|
||||
|
||||
public StationStatus(Station station) {
|
||||
super(station.getCode(), station.getDeviceType());
|
||||
this.controlMode = station.getControlMode();
|
||||
@ -87,6 +89,7 @@ public class StationStatus extends DeviceStatus {
|
||||
this.emergencyController = station.isEmergencyController();
|
||||
this.controlApplicant = station.getControlApplicantId();
|
||||
this.preResetValidDuration = station.getPreResetValidDurationInSeconds();
|
||||
this.interlockMachineStarting = station.isInterlockMachineStarting();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -150,6 +153,11 @@ public class StationStatus extends DeviceStatus {
|
||||
this.preResetValidDuration = station.getPreResetValidDurationInSeconds();
|
||||
status.setPreResetValidDuration(this.preResetValidDuration);
|
||||
}
|
||||
if (!Objects.equals(this.interlockMachineStarting, station.isInterlockMachineStarting())) {
|
||||
change = true;
|
||||
this.interlockMachineStarting = station.isInterlockMachineStarting();
|
||||
status.setInterlockMachineStarting(this.interlockMachineStarting);
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@ -167,6 +175,7 @@ public class StationStatus extends DeviceStatus {
|
||||
statusVO.setEmergencyController(emergencyController);
|
||||
statusVO.setControlApplicant(controlApplicant);
|
||||
statusVO.setPreResetValidDuration(preResetValidDuration);
|
||||
statusVO.setInterlockMachineStarting(interlockMachineStarting);
|
||||
return statusVO;
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,9 @@ public class SwitchStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean atsNoStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean preReset;
|
||||
|
||||
@ -97,11 +100,13 @@ public class SwitchStatus extends DeviceStatus {
|
||||
this.pos = aSwitch.getPos();
|
||||
this.delayTime = aSwitch.getRemain() / 1000;
|
||||
this.noStatus = aSwitch.isNoStatus();
|
||||
this.atsNoStatus = aSwitch.isAtsNoStatus();
|
||||
this.preReset = aSwitch.isPreReset();
|
||||
this.auto = aSwitch.isAuto();
|
||||
this.dispatcherReserve = aSwitch.isDispatcherReserve();
|
||||
this.interlockReserve = aSwitch.isInterlockReserve();
|
||||
this.blockadeInvalid = aSwitch.isBlockadeInvalid();
|
||||
this.fault = (Switch.SwitchFault) aSwitch.getFault();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -150,6 +155,11 @@ public class SwitchStatus extends DeviceStatus {
|
||||
status.setNoStatus(this.noStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.atsNoStatus, aSwitch.isAtsNoStatus())) {
|
||||
this.atsNoStatus = aSwitch.isAtsNoStatus();
|
||||
status.setAtsNoStatus(this.atsNoStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.preReset, aSwitch.isPreReset())) {
|
||||
this.preReset = aSwitch.isPreReset();
|
||||
status.setPreReset(this.preReset);
|
||||
@ -193,6 +203,7 @@ public class SwitchStatus extends DeviceStatus {
|
||||
statusVO.setBlockade(blockade);
|
||||
statusVO.setSingleLock(singleLock);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setAtsNoStatus(atsNoStatus);
|
||||
statusVO.setPreReset(preReset);
|
||||
statusVO.setAuto(auto);
|
||||
statusVO.setDispatcherReserve(dispatcherReserve);
|
||||
|
@ -29,6 +29,9 @@ public class PSDStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean atsNoStatus;
|
||||
|
||||
public PSDStatusVO(PSD psd) {
|
||||
super(psd.getCode(), psd.getDeviceType());
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.data.vo;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
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.Setter;
|
||||
@ -55,6 +56,9 @@ public class SectionStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean atsNoStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean preReset;
|
||||
|
||||
@ -64,6 +68,7 @@ public class SectionStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean closed;
|
||||
|
||||
@JsonInclude
|
||||
private String fault;
|
||||
|
||||
public SectionStatusVO(Section section) {
|
||||
|
@ -51,6 +51,9 @@ public class SignalStatusVO extends DeviceStatusVO{
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean atsNoStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean approachLock;
|
||||
|
||||
|
@ -86,6 +86,9 @@ public class StandStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean atsNoStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean closed;
|
||||
|
||||
|
@ -70,6 +70,8 @@ public class StationStatusVO extends DeviceStatusVO {
|
||||
|
||||
private Integer preResetValidDuration;
|
||||
|
||||
private Boolean interlockMachineStarting;
|
||||
|
||||
public StationStatusVO(Station station) {
|
||||
super(station.getCode(), station.getDeviceType());
|
||||
}
|
||||
|
@ -52,6 +52,9 @@ public class SwitchStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean atsNoStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean preReset;
|
||||
|
||||
@ -73,4 +76,12 @@ public class SwitchStatusVO extends DeviceStatusVO {
|
||||
public SwitchStatusVO(Switch aSwitch) {
|
||||
super(aSwitch.getCode(), aSwitch.getDeviceType());
|
||||
}
|
||||
|
||||
public void setAtsNoStatus(boolean atsNoStatus) {
|
||||
this.atsNoStatus = atsNoStatus;
|
||||
}
|
||||
|
||||
public boolean getAtsNoStatus() {
|
||||
return atsNoStatus;
|
||||
}
|
||||
}
|
||||
|
@ -1445,10 +1445,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
* 是否比该模式级别更高
|
||||
*/
|
||||
public boolean isHigherThan(PreselectionMode mode) {
|
||||
if (this.runLevel.isHigherThan(mode.runLevel)) {
|
||||
return true;
|
||||
if (this.runLevel.equals(mode.runLevel)) {
|
||||
return this.driveMode.isHigherThan(mode.driveMode);
|
||||
} else {
|
||||
return this.runLevel.isHigherThan(mode.runLevel);
|
||||
}
|
||||
return this.driveMode.isHigherThan(mode.driveMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user