Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
sheng 2020-12-21 22:15:26 +08:00
commit 3dd75b34c2
33 changed files with 583 additions and 139 deletions

View File

@ -48,17 +48,22 @@ public class ZCLogicLoop {
List<VirtualRealityTrain> trainList = simulation.getRepository().getOnlineTrainList(); List<VirtualRealityTrain> trainList = simulation.getRepository().getOnlineTrainList();
trainList.forEach(train -> { trainList.forEach(train -> {
SectionPosition headPosition = train.getHeadPosition(); SectionPosition headPosition = train.getHeadPosition();
Station deviceStation = headPosition.getSection().getDeviceStation();
RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode(); RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
if (RunLevel.ITC.equals(defaultRunLevel)) { //如果线路最高运行级别为ITC级别 if (RunLevel.ITC.equals(defaultRunLevel)) { //如果线路最高运行级别为ITC级别
this.calculateMAOfITC(simulation, train, trainList); if (!Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
} else if (RunLevel.CBTC.equals(defaultRunLevel)) {
//更新ITC ma
Float distance2NextSignal = train.calculateDistance2NextNormalOpenSignal();
if (distance2NextSignal != null && distance2NextSignal <= 5) {
this.calculateMAOfITC(simulation, train, trainList); this.calculateMAOfITC(simulation, train, trainList);
} }
} else if (RunLevel.CBTC.equals(defaultRunLevel)) {
//更新ITC ma
if (!Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
Float distance2NextSignal = train.calculateDistance2NextNormalOpenSignal();
if (distance2NextSignal != null && distance2NextSignal <= 5) {
this.calculateMAOfITC(simulation, train, trainList);
}
}
//更新CBTC ma //更新CBTC ma
if (!headPosition.getSection().getDeviceStation().getZc().isFault()) { //如果列车头所在区段所属设备集中站zc未故障 if (!deviceStation.isFault()) { //如果列车头所在区段所属设备集中站zc未故障
this.calculateMAOfCBTC(simulation, train, trainList); this.calculateMAOfCBTC(simulation, train, trainList);
} }
} }

View File

@ -225,6 +225,8 @@ public class Operation {
Station_Close_AllSignal, Station_Close_AllSignal,
/** 关区信号 */ /** 关区信号 */
Station_CIArea_Close_AllSignal, Station_CIArea_Close_AllSignal,
/** 重启令解(哈尔滨) */
Station_Restart,
//--------------------------- 列车 --------------------------- //--------------------------- 列车 ---------------------------
/** 在指定区段加载一辆计划列车(本地开发使用) */ /** 在指定区段加载一辆计划列车(本地开发使用) */

View File

@ -6,7 +6,8 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler
import club.joylink.rtss.simulation.cbtc.ATS.operation.service.*; import club.joylink.rtss.simulation.cbtc.ATS.operation.service.*;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.FaultParam; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.FaultParam;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -39,6 +40,9 @@ public class FaultOperateHandler {
@Autowired @Autowired
private CatenaryFaultService catenaryFaultService; private CatenaryFaultService catenaryFaultService;
@Autowired
private StationFaultService stationFaultService;
/** /**
* 设备设置故障 * 设备设置故障
* *
@ -129,6 +133,12 @@ public class FaultOperateHandler {
return; return;
case STATION: case STATION:
if (isSet) {
stationFaultService.setFault(simulation, mayOutOfOrderDevice, param);
return;
}
stationFaultService.fixFault(simulation, mayOutOfOrderDevice, param);
return;
case TRAIN: case TRAIN:
return; return;
case STAND: case STAND:

View File

@ -194,4 +194,10 @@ public class StationOperateHandler {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
this.atsStationService.receiveControl(simulation, member, repository.getByCode(stationCode, Station.class)); this.atsStationService.receiveControl(simulation, member, repository.getByCode(stationCode, Station.class));
} }
@OperateHandlerMapping(type = Operation.Type.Station_Restart)
public void restart(Simulation simulation, String stationCode) {
SimulationDataRepository repository = simulation.getRepository();
this.ciApiService.restart(simulation, repository.getByCode(stationCode, Station.class));
}
} }

View File

@ -0,0 +1,67 @@
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.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
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.Component;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class StationFaultService implements DeviceFaultService {
@Autowired
private ApplicationContext applicationContext;
@Override
public void setFault(Simulation simulation, MayOutOfOrderDevice device, FaultParam param) {
Station.Fault fault = checkAndGetFault(param);
boolean apply = fault.apply(device);
if (apply) {
this.applicationContext.publishEvent(new SimulationDeviceFaultSetEvent(this,
simulation, new DeviceFaultInfo(device.getCode(), device.getDeviceType(), fault)));
}
}
@Override
public void fixFault(Simulation simulation, MayOutOfOrderDevice device, FaultParam param) {
Station.Fault fault = checkAndGetFault(param);
MayOutOfOrderDevice.DeviceFault deviceFault = device.getFault();
fault.fix(device);
if (fault.equals(deviceFault) && fault.equals(Station.Fault.INTERLOCK_MACHINE_FAULT)) {
Station station = (Station) device;
if (station.getDeviceStation() != null) {
station = station.getDeviceStation();
}
Station deviceStation = station;
SimulationDataRepository repository = simulation.getRepository();
List<Section> sections = repository.getSectionList().stream()
.filter(section -> section.getDeviceStation().equals(deviceStation)).collect(Collectors.toList());
for (Section section : sections) {
if (section.isRouteLock()) {
continue;
}
section.setNctOccupied(true);
if (section.isSwitchAxleCounterSection()) {
section.getLogicList().forEach(switchSection -> switchSection.setNctOccupied(true));
}
}
}
this.applicationContext.publishEvent(new SimulationDeviceFaultOverEvent(this,
simulation, new DeviceFaultInfo(device.getCode(), device.getDeviceType(), fault)));
}
@Override
public Station.Fault checkAndGetFault(FaultParam param) {
return Station.Fault.valueOf(param.getFaultType());
}
}

View File

@ -47,7 +47,7 @@ public class AtsRouteSettingService {
// 执行进路排列 // 执行进路排列
for (TrainRoute trainRoute : waitSetList) { for (TrainRoute trainRoute : waitSetList) {
Route route = trainRoute.getRoute(); Route route = trainRoute.getRoute();
if (!route.isSetting() && !route.isLock()) { if (!simulation.getRepository().hasSettingRoute(route)) {
this.ciApiService.settingRoute(simulation, route.getCode()); this.ciApiService.settingRoute(simulation, route.getCode());
} }
} }

View File

@ -91,84 +91,16 @@ public class CILogicLoop {
*/ */
public void getStatusFromVRDevice(Simulation simulation) { public void getStatusFromVRDevice(Simulation simulation) {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
List<Signal> signalList = repository.getSignalList(); List<Signal> signalList = getSignalsStatusFromVRDevice(simulation);
for (Signal signal : signalList) { List<Switch> switchList = getSwitchesStatusFromVRDevice(repository);
if (signal.isLogicLight() || signal.isVirtual()) { getSectionsStatusFromVRDevice(repository);
continue; getPsdStatusFromVRDevice(repository);
} else if (signal.isGuideOpen()) {
int guideRemain = signal.getGuideRemain();
if (guideRemain != -1) { // 非无限开放
guideRemain -= SimulationModule.CI.getRateMs();
if (guideRemain <= 0) {
// 关闭引导信号
this.signalService.close(simulation, signal);
signal.updateGuideRemain(0);
} else {
signal.updateGuideRemain(guideRemain);
}
}
}
VirtualRealitySignal virtualSignal = signal.getVirtualSignal();
signal.apply(virtualSignal.isGreenOpen(), virtualSignal.isYellowOpen(), virtualSignal.isRedOpen());
}
// 道岔位置状态
List<Switch> switchList = repository.getListByType(MapElement.DeviceType.SWITCH, Switch.class);
switchList.forEach(aSwitch -> {
Switch.SwitchFault fault = (Switch.SwitchFault) aSwitch.getFault();
if (fault != null) {
aSwitch.setSplit(true);
switch (fault) {
case SPLIT:
break;
case NORMAL_SPLIT: {
VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
aSwitch.apply(false, virtualSwitch.isReverse());
break;
}
case REVERSE_SPLIT: {
VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
aSwitch.apply(virtualSwitch.isNormal(), false);
break;
}
}
} else {
aSwitch.setSplit(false);
VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
aSwitch.apply(virtualSwitch.isNormal(), virtualSwitch.isReverse());
}
});
// 区段占用
List<Section> axleSectionList = repository.getAxleSectionList();
axleSectionList.forEach(section -> {
// if (section.isInvalid() && section.isFault()) {
// section.setNctOccupied(false);
// return;
// }
// if (section.isFault()) {
// section.setNctOccupied(true);
// return;
// }
if (Section.AxleFault.UNABLE_COLLECT_STATUS.equals(section.getFault()))
return;
VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter();
if (virtualAxleCounter.isOccupy()) {
section.axleCounterOccupy(virtualAxleCounter.isRight());
} else {
section.axleCounterClear();
}
section.judgeAsValid();
});
// 站台屏蔽门开关门等状态
List<PSD> psdList = repository.getListByType(MapElement.DeviceType.PSD, PSD.class);
psdList.forEach(psd -> {
VirtualRealityScreenDoor vrScreenDoor = psd.getVirtualScreenDoor();
psd.apply(vrScreenDoor.isClose(), vrScreenDoor.isLock(), vrScreenDoor.isInterlockRelease());
});
// 道岔状态发送ATS // 道岔状态发送ATS
this.atsApiService.handleDeviceStatus(simulation, signalList); this.atsApiService.handleDeviceStatus(simulation, signalList);
this.atsApiService.handleDeviceStatus(simulation, switchList); this.atsApiService.handleDeviceStatus(simulation, switchList);
} }
/** /**
* 进路相关逻辑 * 进路相关逻辑
*/ */
@ -176,6 +108,13 @@ public class CILogicLoop {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
List<Route> routeList = repository.getRouteList(); List<Route> routeList = repository.getRouteList();
for (Route route : routeList) { for (Route route : routeList) {
//联锁机故障逻辑
Station deviceStation = route.getStart().getDeviceStation();
if (deviceStation != null) {
if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
continue;
}
}
// Route.CheckFailMessage result = this.routeService.check(simulation, route); // Route.CheckFailMessage result = this.routeService.check(simulation, route);
// if (Objects.nonNull(result)) { // if (Objects.nonNull(result)) {
// route.setSettable(false); // route.setSettable(false);
@ -192,6 +131,14 @@ public class CILogicLoop {
if (!CollectionUtils.isEmpty(settingRoutes)) { if (!CollectionUtils.isEmpty(settingRoutes)) {
// 获取所有列车方向速度位置信息用以解锁进路 // 获取所有列车方向速度位置信息用以解锁进路
for (Route route : settingRoutes) { for (Route route : settingRoutes) {
//联锁机故障逻辑
Station deviceStation = route.getStart().getDeviceStation();
if (deviceStation != null) {
if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
continue;
}
}
if (route.isNormalUnlock()) { // 进路锁闭若进路内存在列车执行正常解锁 if (route.isNormalUnlock()) { // 进路锁闭若进路内存在列车执行正常解锁
this.routeService.normalUnlock(simulation, route); this.routeService.normalUnlock(simulation, route);
} }
@ -230,4 +177,175 @@ public class CILogicLoop {
} }
} }
/**
* 从真实设置获取屏蔽门的状态
*/
private void getPsdStatusFromVRDevice(SimulationDataRepository repository) {
// 站台屏蔽门开关门等状态
List<PSD> psdList = repository.getListByType(MapElement.DeviceType.PSD, PSD.class);
psdList.forEach(psd -> {
//联锁机故障
Stand stand = psd.getStand();
Station deviceStation = stand.getDeviceStation();
if (deviceStation != null) {
if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
stand.setNoStatus(true);
psd.setNoStatus(true);
return;
} else {
stand.setNoStatus(false);
psd.setNoStatus(false);
}
if (deviceStation.isInterlockMachineStarting())
return;
} else {
stand.setNoStatus(false);
psd.setNoStatus(false);
}
VirtualRealityScreenDoor vrScreenDoor = psd.getVirtualScreenDoor();
psd.apply(vrScreenDoor.isClose(), vrScreenDoor.isLock(), vrScreenDoor.isInterlockRelease());
});
}
/**
* 更新区段逻辑
*/
private void getSectionsStatusFromVRDevice(SimulationDataRepository repository) {
// 区段占用
List<Section> axleSectionList = repository.getAxleSectionList();
axleSectionList.forEach(section -> {
//联锁机故障
boolean interlockMachineFault = false;
boolean interlockMachineStarting = false;
Station deviceStation = section.getDeviceStation();
if (deviceStation != null) {
if (deviceStation.isInterlockMachineStarting())
interlockMachineStarting = true;
if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault()))
interlockMachineFault = true;
}
if (interlockMachineFault) {
section.setNoStatus(true);
if (section.isSwitchAxleCounterSection()) {
section.getLogicList().forEach(switchSection -> switchSection.setNoStatus(true));
}
} else {
section.setNoStatus(false);
if (section.isSwitchAxleCounterSection()) {
section.getLogicList().forEach(switchSection -> switchSection.setNoStatus(false));
}
}
if (interlockMachineStarting)
return;
// if (section.isInvalid() && section.isFault()) {
// section.setNctOccupied(false);
// return;
// }
// if (section.isFault()) {
// section.setNctOccupied(true);
// return;
// }
if (Section.AxleFault.UNABLE_COLLECT_STATUS.equals(section.getFault()))
return;
VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter();
if (virtualAxleCounter.isOccupy()) {
section.axleCounterOccupy(virtualAxleCounter.isRight());
} else {
section.axleCounterClear();
}
section.judgeAsValid();
});
}
/**
* 从真实设备获取道岔状态
*/
private List<Switch> getSwitchesStatusFromVRDevice(SimulationDataRepository repository) {
// 道岔位置状态
List<Switch> switchList = repository.getListByType(MapElement.DeviceType.SWITCH, Switch.class);
switchList.forEach(aSwitch -> {
//联锁机故障逻辑
Station deviceStation = aSwitch.getDeviceStation();
if (deviceStation != null) {
if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
aSwitch.setNoStatus(true);
return;
} else {
aSwitch.setNoStatus(false);
}
if (deviceStation.isInterlockMachineStarting())
return;
} else {
aSwitch.setNoStatus(false);
}
Switch.SwitchFault fault = (Switch.SwitchFault) aSwitch.getFault();
if (fault != null) {
aSwitch.setSplit(true);
switch (fault) {
case SPLIT:
break;
case NORMAL_SPLIT: {
VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
aSwitch.apply(false, virtualSwitch.isReverse());
break;
}
case REVERSE_SPLIT: {
VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
aSwitch.apply(virtualSwitch.isNormal(), false);
break;
}
}
} else {
aSwitch.setSplit(false);
VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
aSwitch.apply(virtualSwitch.isNormal(), virtualSwitch.isReverse());
}
});
return switchList;
}
/**
* 从真实设备获取信号机状态
*/
private List<Signal> getSignalsStatusFromVRDevice(Simulation simulation) {
SimulationDataRepository repository = simulation.getRepository();
List<Signal> signalList = repository.getSignalList();
for (Signal signal : signalList) {
//联锁机故障逻辑
Station deviceStation = signal.getDeviceStation();
if (deviceStation != null) {
if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
signal.setNoStatus(true);
continue;
} else {
signal.setNoStatus(false);
}
if (deviceStation.isInterlockMachineStarting())
continue;
} else {
signal.setNoStatus(false);
}
if (signal.isLogicLight() || signal.isVirtual()) {
continue;
} else if (signal.isGuideOpen()) {
int guideRemain = signal.getGuideRemain();
if (guideRemain != -1) { // 非无限开放
guideRemain -= SimulationModule.CI.getRateMs();
if (guideRemain <= 0) {
// 关闭引导信号
this.signalService.close(simulation, signal);
signal.updateGuideRemain(0);
} else {
signal.updateGuideRemain(guideRemain);
}
}
}
VirtualRealitySignal virtualSignal = signal.getVirtualSignal();
signal.apply(virtualSignal.isGreenOpen(), virtualSignal.isYellowOpen(), virtualSignal.isRedOpen());
}
return signalList;
}
} }

View File

@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.CI;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.ESP; import club.joylink.rtss.simulation.cbtc.data.map.ESP;
import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage; import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage; import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
@ -297,4 +298,9 @@ public interface CiApiService {
void setEst(Simulation simulation, ESP esp); void setEst(Simulation simulation, ESP esp);
void cancelEst(Simulation simulation, ESP esp); void cancelEst(Simulation simulation, ESP esp);
/**
* 重启令解
*/
void restart(Simulation simulation, Station station);
} }

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.CI; package club.joylink.rtss.simulation.cbtc.CI;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.CI.service.*; import club.joylink.rtss.simulation.cbtc.CI.service.*;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
@ -16,6 +17,7 @@ import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -79,16 +81,20 @@ public class CiApiServiceImpl implements CiApiService {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
"信号机已经开启,无需重开信号机"); "信号机已经开启,无需重开信号机");
} }
Route lockedRoute = signal.getLockedRoute(); Optional<Route> routeOptional = simulation.getRepository().getSettingRoutes().stream()
if (Objects.isNull(lockedRoute)) { .filter(route -> route.getStart().equals(signal)).limit(1).findAny();
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(routeOptional.isPresent());
"进路未锁闭,不能重开信号机"); settingRoute(simulation, routeOptional.get().getCode());
} // Route lockedRoute = signal.getLockedRoute();
if (!this.routeService.isInterlocked(lockedRoute)) { // if (Objects.isNull(lockedRoute)) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, // throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
String.format("进路[%s(%s)]联锁关系不满足,不能重开信号机", lockedRoute.getName(), lockedRoute.getCode())); // "进路未锁闭,不能重开信号机");
} // }
this.routeService.routeOpen(simulation, lockedRoute); // if (!this.routeService.isInterlocked(lockedRoute)) {
// throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
// String.format("进路[%s(%s)]联锁关系不满足,不能重开信号机", lockedRoute.getName(), lockedRoute.getCode()));
// }
// this.routeService.routeOpen(simulation, lockedRoute);
} }
@Override @Override
@ -419,4 +425,20 @@ public class CiApiServiceImpl implements CiApiService {
public void cancelEst(Simulation simulation, ESP esp) { public void cancelEst(Simulation simulation, ESP esp) {
esp.update(false); esp.update(false);
} }
@Override
public void restart(Simulation simulation, Station station) {
Station deviceStation;
if (station.isCentralized()) {
deviceStation = station;
} else {
deviceStation = station.getDeviceStation();
}
SimulationDataRepository repository = simulation.getRepository();
//信号机和进路
List<Signal> signals = repository.getSignalList().stream()
.filter(signal -> signal.getDeviceStation().equals(deviceStation)).collect(Collectors.toList());
signals.forEach(Signal::reset);
deviceStation.setInterlockMachineStarting(false);
}
} }

View File

@ -725,6 +725,9 @@ public class RouteService {
if (!section.isRouteLockOn(right)) { if (!section.isRouteLockOn(right)) {
return false; return false;
} }
if (section.isNoStatus()) {
return false;
}
} }
// 道岔位置一致检查 // 道岔位置一致检查
Set<Switch> sectionRelSwitches = sectionList.stream().map(Section::getRelSwitch).collect(Collectors.toSet()); Set<Switch> sectionRelSwitches = sectionList.stream().map(Section::getRelSwitch).collect(Collectors.toSet());

View File

@ -42,9 +42,6 @@ public abstract class MayOutOfOrderDevice extends MapNamedElement {
boolean apply(MayOutOfOrderDevice device); boolean apply(MayOutOfOrderDevice device);
default void fix(MayOutOfOrderDevice device) { default void fix(MayOutOfOrderDevice device) {
if (device.fault == null) {
return;
}
if (this.equals(device.fault)) if (this.equals(device.fault))
device.fault = null; device.fault = null;
} }

View File

@ -36,11 +36,15 @@ public class PSD extends MapNamedElement {
/** 是否互锁解除 */ /** 是否互锁解除 */
private boolean interlockRelease; private boolean interlockRelease;
/** 无状态 */
private boolean noStatus;
@Override @Override
public void reset() { public void reset() {
this.close = true; this.close = true;
this.lock = true; this.lock = true;
this.interlockRelease = false; this.interlockRelease = false;
this.noStatus = false;
} }
public boolean isCloseAndLock() { public boolean isCloseAndLock() {

View File

@ -408,6 +408,8 @@ public class Route extends MapNamedElement {
} }
public synchronized void startSetting(LocalDateTime systemTime) { public synchronized void startSetting(LocalDateTime systemTime) {
if (getCode().equals("Route533"))
System.out.println();
this.setSetting(true); this.setSetting(true);
this.settingStartTime = systemTime; this.settingStartTime = systemTime;
this.requisition = false; this.requisition = false;

View File

@ -209,6 +209,11 @@ public class Section extends MayOutOfOrderDevice {
*/ */
private int delayTime; private int delayTime;
/**
* 无状态哈尔滨灰显
*/
private boolean noStatus;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -223,6 +228,7 @@ public class Section extends MayOutOfOrderDevice {
this.faultLock = false; this.faultLock = false;
this.speedUpLimit = -1; this.speedUpLimit = -1;
this.delayTime = 0; this.delayTime = 0;
this.noStatus = false;
} }
/** /**
@ -746,6 +752,8 @@ public class Section extends MayOutOfOrderDevice {
} }
public boolean isRouteLockOn(boolean right) { public boolean isRouteLockOn(boolean right) {
if (noStatus)
return false;
return this.routeLock && Objects.equals(this.lockRight, right); return this.routeLock && Objects.equals(this.lockRight, right);
} }
@ -916,7 +924,7 @@ public class Section extends MayOutOfOrderDevice {
}, },
/** /**
* 无法从真实设备采集状态哈尔滨灰显 * 无法从真实设备采集状态哈尔滨灰显可能没用了
*/ */
UNABLE_COLLECT_STATUS { UNABLE_COLLECT_STATUS {
@Override @Override

View File

@ -167,6 +167,11 @@ public class Signal extends MayOutOfOrderDevice {
*/ */
private SignalApproachMessage.ApproachMessage approachMsg; private SignalApproachMessage.ApproachMessage approachMsg;
/**
* 无状态
*/
private boolean noStatus;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -179,6 +184,7 @@ public class Signal extends MayOutOfOrderDevice {
this.delayTime = 0; this.delayTime = 0;
this.guideRemain = 0; this.guideRemain = 0;
this.approachMsg = SignalApproachMessage.ApproachMessage.NULL; this.approachMsg = SignalApproachMessage.ApproachMessage.NULL;
this.noStatus = false;
} }
@Override @Override
@ -315,8 +321,6 @@ public class Signal extends MayOutOfOrderDevice {
/** /**
* 是否与轨道常规运行方向相同 * 是否与轨道常规运行方向相同
*
* @return
*/ */
public boolean isSameDirectionToSection() { public boolean isSameDirectionToSection() {
return (this.isRight() && Objects.equals(this.section.getRoadType(), Section.SectionRoadType.RIGHT)) return (this.isRight() && Objects.equals(this.section.getRoadType(), Section.SectionRoadType.RIGHT))

View File

@ -132,6 +132,11 @@ public class Stand extends MayOutOfOrderDevice {
*/ */
private TurnBackType typeStrategy; private TurnBackType typeStrategy;
/**
* 无状态
*/
private boolean noStatus;
/** /**
* 折返路径策略 * 折返路径策略
*/ */
@ -153,6 +158,7 @@ public class Stand extends MayOutOfOrderDevice {
this.runLevelTimeForever = false; this.runLevelTimeForever = false;
this.parkingTime = -1; this.parkingTime = -1;
this.parkingAlwaysValid = false; this.parkingAlwaysValid = false;
this.noStatus = false;
} }
/** /**

View File

@ -20,7 +20,7 @@ import java.util.stream.Collectors;
@Getter @Getter
@Setter @Setter
public class Station extends MapNamedElement { public class Station extends MayOutOfOrderDevice {
public Station(String code, String name) { public Station(String code, String name) {
super(code, name, DeviceType.STATION); super(code, name, DeviceType.STATION);
this.transferList = new ArrayList<>(); this.transferList = new ArrayList<>();
@ -151,8 +151,14 @@ public class Station extends MapNamedElement {
*/ */
private Integer validDuration; private Integer validDuration;
/**
* 联锁机启动中
*/
private boolean interlockMachineStarting;
@Override @Override
public void reset() { public void reset() {
super.reset();
if (this.vrIbp != null) { if (this.vrIbp != null) {
vrIbp.reset(); vrIbp.reset();
} }
@ -167,6 +173,7 @@ public class Station extends MapNamedElement {
this.applicant = null; this.applicant = null;
this.apply2TheControlMode = null; this.apply2TheControlMode = null;
this.validDuration = null; this.validDuration = null;
this.interlockMachineStarting = false;
} }
public List<Stand> getStandOf(boolean right) { public List<Stand> getStandOf(boolean right) {
@ -433,4 +440,36 @@ public class Station extends MapNamedElement {
Station station = (Station) obj; Station station = (Station) obj;
return getCode().equals(station.getCode()); return getCode().equals(station.getCode());
} }
public enum Fault implements DeviceFault {
/**
* 联锁机故障
*/
INTERLOCK_MACHINE_FAULT {
@Override
public boolean apply(MayOutOfOrderDevice device) {
Station station = (Station) device;
if (station.getDeviceStation() != null) {
station = station.getDeviceStation();
}
if (Objects.equals(this, station.getFault()))
return false;
station.setFault(this);
return true;
}
@Override
public void fix(MayOutOfOrderDevice device) {
Station station = (Station) device;
if (station.getDeviceStation() != null) {
station = station.getDeviceStation();
}
if (!Objects.equals(this, device.getFault()))
return;
station.setInterlockMachineStarting(true);
station.setFault(null);
}
}
}
} }

View File

@ -94,6 +94,11 @@ public class Switch extends MayOutOfOrderDevice {
*/ */
private boolean split; private boolean split;
/**
* 无状态
*/
private boolean noStatus;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -106,6 +111,7 @@ public class Switch extends MayOutOfOrderDevice {
this.reversePosition = false; this.reversePosition = false;
this.delayTime = 0; this.delayTime = 0;
this.split = false; this.split = false;
this.noStatus = false;
} }
/** /**

View File

@ -1,14 +1,13 @@
package club.joylink.rtss.simulation.cbtc.data.status; package club.joylink.rtss.simulation.cbtc.data.status;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.PSD; import club.joylink.rtss.simulation.cbtc.data.map.PSD;
import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.PSDStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.PSDStatusVO;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import java.util.Objects; import java.util.Objects;
@ -34,11 +33,15 @@ public class PSDStatus extends DeviceStatus {
@JsonDeserialize(using = Boolean2NumDeserializer.class) @JsonDeserialize(using = Boolean2NumDeserializer.class)
private boolean interlockRelease; private boolean interlockRelease;
@JsonSerialize(using = Boolean2NumSerializer.class)
private boolean noStatus;
public PSDStatus(PSD psd) { public PSDStatus(PSD psd) {
super(psd.getCode(), psd.getDeviceType()); super(psd.getCode(), psd.getDeviceType());
this.close = psd.isCloseAndLock(); this.close = psd.isCloseAndLock();
// this.lock = psd.isLock(); // this.lock = psd.isLock();
this.interlockRelease = psd.isInterlockRelease(); this.interlockRelease = psd.isInterlockRelease();
this.noStatus = psd.isNoStatus();
} }
@Override @Override
@ -60,6 +63,11 @@ public class PSDStatus extends DeviceStatus {
status.setClose(this.interlockRelease); status.setClose(this.interlockRelease);
change = true; change = true;
} }
if (!Objects.equals(this.noStatus, psd.isNoStatus())) {
this.noStatus = psd.isNoStatus();
status.setNoStatus(noStatus);
change = true;
}
return change; return change;
} }

View File

@ -16,45 +16,71 @@ import java.util.Objects;
@Getter @Getter
public class SectionStatus extends DeviceStatus { public class SectionStatus extends DeviceStatus {
/** 是否封锁 */ /**
* 是否封锁
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean blockade; private boolean blockade;
/** 是否进路锁闭 */ /**
* 是否进路锁闭
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean routeLock; private boolean routeLock;
/** 锁闭方向 */ /**
* 锁闭方向
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean lockRight; private boolean lockRight;
/** 进路延续保护锁闭 */ /**
* 进路延续保护锁闭
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean overlapLock; private boolean overlapLock;
/** 通信车占用 */ /**
* 通信车占用
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean ctOccupied; private boolean ctOccupied;
/** 非通信车占用 */ /**
* 非通信车占用
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean nctOccupied; private boolean nctOccupied;
/**是否切除*/ /**
* 是否切除
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean cutOff; private boolean cutOff;
/**是否失效*/ /**
* 是否失效
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean invalid; private boolean invalid;
/** 故障锁闭 */ /**
* 故障锁闭
*/
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean faultLock; private boolean faultLock;
/**最高限速*/ /**
* 最高限速
*/
private int speedUpLimit; private int speedUpLimit;
/**
* 无状态
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private boolean noStatus;
private String fault; private String fault;
public SectionStatus(Section section) { public SectionStatus(Section section) {
@ -69,6 +95,7 @@ public class SectionStatus extends DeviceStatus {
this.invalid = section.isInvalid(); this.invalid = section.isInvalid();
this.faultLock = section.isFaultLock(); this.faultLock = section.isFaultLock();
this.speedUpLimit = section.getSpeedUpLimit(); this.speedUpLimit = section.getSpeedUpLimit();
this.noStatus = section.isNoStatus();
this.fault = section.getFault() == null ? null : section.getFault().toString(); this.fault = section.getFault() == null ? null : section.getFault().toString();
} }
@ -127,6 +154,11 @@ public class SectionStatus extends DeviceStatus {
status.setSpeedUpLimit(this.speedUpLimit); status.setSpeedUpLimit(this.speedUpLimit);
change = true; change = true;
} }
if (!Objects.equals(this.noStatus, section.isNoStatus())) {
this.noStatus = section.isNoStatus();
status.setNoStatus(noStatus);
change = true;
}
return change; return change;
} }

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.simulation.cbtc.data.status; package club.joylink.rtss.simulation.cbtc.data.status;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; 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.Signal; import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.SignalStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.SignalStatusVO;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import java.util.Objects; import java.util.Objects;
@ -50,6 +50,9 @@ public class SignalStatus extends DeviceStatus {
/** 信号机延时解锁倒计时 */ /** 信号机延时解锁倒计时 */
private Integer remainTime; private Integer remainTime;
@JsonSerialize(using = Boolean2NumSerializer.class)
private boolean noStatus;
/**故障*/ /**故障*/
private String fault; private String fault;
@ -62,6 +65,7 @@ public class SignalStatus extends DeviceStatus {
this.yellowOpen = signal.isYellowOpen(); this.yellowOpen = signal.isYellowOpen();
this.redOpen = signal.isRedOpen(); this.redOpen = signal.isRedOpen();
this.remainTime = signal.getDelayTime(); this.remainTime = signal.getDelayTime();
this.noStatus = signal.isNoStatus();
this.fault = Objects.nonNull(signal.getFault())?((Signal.SignalFault)signal.getFault()).name():null; this.fault = Objects.nonNull(signal.getFault())?((Signal.SignalFault)signal.getFault()).name():null;
} }
@ -110,6 +114,11 @@ public class SignalStatus extends DeviceStatus {
} else { } else {
status.setRemainTime(null); status.setRemainTime(null);
} }
if (!Objects.equals(this.noStatus, signal.isNoStatus())) {
this.noStatus = signal.isNoStatus();
status.setNoStatus(noStatus);
change = true;
}
MayOutOfOrderDevice.DeviceFault fault = signal.getFault(); MayOutOfOrderDevice.DeviceFault fault = signal.getFault();
if (!Objects.equals(this.fault, Objects.nonNull(fault) ? ((Signal.SignalFault) fault).name():null)) { if (!Objects.equals(this.fault, Objects.nonNull(fault) ? ((Signal.SignalFault) fault).name():null)) {
if(Objects.isNull(fault)){ if(Objects.isNull(fault)){

View File

@ -1,12 +1,12 @@
package club.joylink.rtss.simulation.cbtc.data.status; package club.joylink.rtss.simulation.cbtc.data.status;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; 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.Stand; import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.StandStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.StandStatusVO;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -70,6 +70,9 @@ public class StandStatus extends DeviceStatus {
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean parkingAlwaysValid; private boolean parkingAlwaysValid;
@JsonSerialize(using = Boolean2NumSerializer.class)
private boolean noStatus;
/**故障*/ /**故障*/
private String fault; private String fault;
@ -96,6 +99,7 @@ public class StandStatus extends DeviceStatus {
this.runLevelTimeForever = stand.isRunLevelTimeForever(); this.runLevelTimeForever = stand.isRunLevelTimeForever();
this.parkingTime = stand.getParkingTime(); this.parkingTime = stand.getParkingTime();
this.parkingAlwaysValid = stand.isParkingAlwaysValid(); this.parkingAlwaysValid = stand.isParkingAlwaysValid();
this.noStatus = stand.isNoStatus();
this.fault = Objects.nonNull(stand.getFault())?((Stand.Fault)stand.getFault()).name():null; this.fault = Objects.nonNull(stand.getFault())?((Stand.Fault)stand.getFault()).name():null;
} }
@ -176,6 +180,11 @@ public class StandStatus extends DeviceStatus {
status.setParkingAlwaysValid(this.parkingAlwaysValid); status.setParkingAlwaysValid(this.parkingAlwaysValid);
change = true; change = true;
} }
if (!Objects.equals(this.noStatus, stand.isNoStatus())) {
this.noStatus = stand.isNoStatus();
status.setNoStatus(noStatus);
change = true;
}
MayOutOfOrderDevice.DeviceFault fault = stand.getFault(); MayOutOfOrderDevice.DeviceFault fault = stand.getFault();
if (!Objects.equals(this.fault, Objects.nonNull(fault)?((Stand.Fault)fault).name():null)) { if (!Objects.equals(this.fault, Objects.nonNull(fault)?((Stand.Fault)fault).name():null)) {
if(Objects.isNull(fault)) { if(Objects.isNull(fault)) {

View File

@ -1,13 +1,13 @@
package club.joylink.rtss.simulation.cbtc.data.status; package club.joylink.rtss.simulation.cbtc.data.status;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.SwitchStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.SwitchStatusVO;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import java.util.Objects; import java.util.Objects;
@ -58,6 +58,9 @@ public class SwitchStatus extends DeviceStatus {
*/ */
private int delayTime; private int delayTime;
@JsonSerialize(using = Boolean2NumSerializer.class)
private boolean noStatus;
public SwitchStatus(Switch aSwitch) { public SwitchStatus(Switch aSwitch) {
super(aSwitch.getCode(), aSwitch.getDeviceType()); super(aSwitch.getCode(), aSwitch.getDeviceType());
this.singleLock = aSwitch.isSingleLock(); this.singleLock = aSwitch.isSingleLock();
@ -68,6 +71,7 @@ public class SwitchStatus extends DeviceStatus {
this.reversePosition = aSwitch.isReversePosition(); this.reversePosition = aSwitch.isReversePosition();
this.split = aSwitch.isSplit(); this.split = aSwitch.isSplit();
this.delayTime = aSwitch.getDelayTime() / 1000; this.delayTime = aSwitch.getDelayTime() / 1000;
this.noStatus = aSwitch.isNoStatus();
} }
@Override @Override
@ -116,6 +120,11 @@ public class SwitchStatus extends DeviceStatus {
status.setDelayTime(dt); status.setDelayTime(dt);
change = true; change = true;
} }
if (!Objects.equals(this.noStatus, aSwitch.isNoStatus())) {
this.noStatus = aSwitch.isNoStatus();
status.setNoStatus(this.noStatus);
change = true;
}
return change; return change;
} }

View File

@ -1,13 +1,13 @@
package club.joylink.rtss.simulation.cbtc.data.storage.device; package club.joylink.rtss.simulation.cbtc.data.storage.device;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.PSD; import club.joylink.rtss.simulation.cbtc.data.map.PSD;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -38,6 +38,13 @@ public class StoragePSD extends StorageDevice {
@JsonDeserialize(using = Boolean2NumDeserializer.class) @JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean interlockRelease; private Boolean interlockRelease;
/**
* 无状态
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
@JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean noStatus;
// public StoragePSD(PSD psd) { // public StoragePSD(PSD psd) {
// super(psd.getCode()); // super(psd.getCode());
// if (!psd.isClose()) { // if (!psd.isClose()) {
@ -70,6 +77,10 @@ public class StoragePSD extends StorageDevice {
change = true; change = true;
storagePSD.setInterlockRelease(psd.isInterlockRelease()); storagePSD.setInterlockRelease(psd.isInterlockRelease());
} }
if (psd.isNoStatus()) {
change = true;
storagePSD.setNoStatus(psd.isNoStatus());
}
if (change) { if (change) {
return storagePSD; return storagePSD;
@ -84,5 +95,6 @@ public class StoragePSD extends StorageDevice {
psd.setClose(close != null ? close : true); psd.setClose(close != null ? close : true);
psd.setLock(lock != null ? lock : true); psd.setLock(lock != null ? lock : true);
psd.setInterlockRelease(interlockRelease != null ? interlockRelease : false); psd.setInterlockRelease(interlockRelease != null ? interlockRelease : false);
psd.setNoStatus(noStatus != null ? noStatus : false);
} }
} }

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.simulation.cbtc.data.storage.device; package club.joylink.rtss.simulation.cbtc.data.storage.device;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; 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.MapElement; 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.map.Section;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -90,6 +90,13 @@ public class StorageSection extends StorageMayOutOfOrderDevice {
*/ */
private Integer delayTime; private Integer delayTime;
/**
* 无状态
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
@JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean noStatus;
public StorageSection(String code, MayOutOfOrderDevice.DeviceFault fault) { public StorageSection(String code, MayOutOfOrderDevice.DeviceFault fault) {
super(code, fault); super(code, fault);
} }
@ -158,6 +165,10 @@ public class StorageSection extends StorageMayOutOfOrderDevice {
change = true; change = true;
storageSection.setDelayTime(section.getDelayTime()); storageSection.setDelayTime(section.getDelayTime());
} }
if (section.isNoStatus()) {
change = true;
storageSection.setNoStatus(section.isNoStatus());
}
if (section.isFault()) { if (section.isFault()) {
change = true; change = true;
} }
@ -183,5 +194,6 @@ public class StorageSection extends StorageMayOutOfOrderDevice {
section.setFaultLock(faultLock != null ? faultLock : false); section.setFaultLock(faultLock != null ? faultLock : false);
section.setSpeedUpLimit(speedUpLimit != null? speedUpLimit : -1); section.setSpeedUpLimit(speedUpLimit != null? speedUpLimit : -1);
section.setDelayTime(delayTime != null ? delayTime : 0); section.setDelayTime(delayTime != null ? delayTime : 0);
section.setNoStatus(noStatus != null ? noStatus : false);
} }
} }

View File

@ -1,15 +1,15 @@
package club.joylink.rtss.simulation.cbtc.data.storage.device; package club.joylink.rtss.simulation.cbtc.data.storage.device;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; 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.MapElement; 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.Route; import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -64,6 +64,13 @@ public class StorageSignal extends StorageMayOutOfOrderDevice {
*/ */
private Integer delayTime; private Integer delayTime;
/**
* 无状态
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
@JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean noStatus;
public StorageSignal(String code, MayOutOfOrderDevice.DeviceFault fault) { public StorageSignal(String code, MayOutOfOrderDevice.DeviceFault fault) {
super(code, fault); super(code, fault);
} }
@ -102,6 +109,10 @@ public class StorageSignal extends StorageMayOutOfOrderDevice {
change = true; change = true;
storageSignal.setDelayTime(signal.getDelayTime()); storageSignal.setDelayTime(signal.getDelayTime());
} }
if (signal.isNoStatus()) {
change = true;
storageSignal.setNoStatus(signal.isNoStatus());
}
if (signal.isFault()) { if (signal.isFault()) {
change = true; change = true;
} }
@ -124,5 +135,6 @@ public class StorageSignal extends StorageMayOutOfOrderDevice {
signal.setYellowOpen(yellowOpen != null ? yellowOpen : false); signal.setYellowOpen(yellowOpen != null ? yellowOpen : false);
signal.setRedOpen(redOpen != null ? redOpen : true); signal.setRedOpen(redOpen != null ? redOpen : true);
signal.setDelayTime(delayTime != null ? delayTime : 0); signal.setDelayTime(delayTime != null ? delayTime : 0);
signal.setNoStatus(noStatus != null ? noStatus : false);
} }
} }

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.simulation.cbtc.data.storage.device; package club.joylink.rtss.simulation.cbtc.data.storage.device;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; 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.MapElement; 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.Stand; import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -102,6 +102,13 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
@JsonDeserialize(using = Boolean2NumDeserializer.class) @JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean parkingAlwaysValid; private Boolean parkingAlwaysValid;
/**
* 无状态
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
@JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean noStatus;
public StorageStand(String code, MayOutOfOrderDevice.DeviceFault fault) { public StorageStand(String code, MayOutOfOrderDevice.DeviceFault fault) {
super(code, fault); super(code, fault);
} }
@ -176,6 +183,10 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
change = true; change = true;
storageStand.setParkingAlwaysValid(stand.isParkingAlwaysValid()); storageStand.setParkingAlwaysValid(stand.isParkingAlwaysValid());
} }
if (stand.isNoStatus()) {
change = true;
storageStand.setNoStatus(stand.isNoStatus());
}
if (stand.isFault()) { if (stand.isFault()) {
change = true; change = true;
} }
@ -203,5 +214,6 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
stand.setRunLevelTimeForever(runLevelTimeForever != null ? runLevelTimeForever : false); stand.setRunLevelTimeForever(runLevelTimeForever != null ? runLevelTimeForever : false);
stand.setParkingTime(parkingTime != null ? parkingTime : -1); stand.setParkingTime(parkingTime != null ? parkingTime : -1);
stand.setParkingAlwaysValid(parkingAlwaysValid != null ? parkingAlwaysValid : false); stand.setParkingAlwaysValid(parkingAlwaysValid != null ? parkingAlwaysValid : false);
stand.setNoStatus(noStatus != null ? noStatus : false);
} }
} }

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.simulation.cbtc.data.storage.device; package club.joylink.rtss.simulation.cbtc.data.storage.device;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; 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.MapElement; 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.Switch; import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -79,6 +79,10 @@ public class StorageSwitch extends StorageMayOutOfOrderDevice {
@JsonDeserialize(using = Boolean2NumDeserializer.class) @JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean split; private Boolean split;
@JsonSerialize(using = Boolean2NumSerializer.class)
@JsonDeserialize(using = Boolean2NumDeserializer.class)
private Boolean noStatus;
public StorageSwitch(String code, MayOutOfOrderDevice.DeviceFault fault) { public StorageSwitch(String code, MayOutOfOrderDevice.DeviceFault fault) {
super(code, fault); super(code, fault);
} }
@ -125,6 +129,10 @@ public class StorageSwitch extends StorageMayOutOfOrderDevice {
change = true; change = true;
storageSwitch.setSplit(s.isSplit()); storageSwitch.setSplit(s.isSplit());
} }
if (s.isNoStatus()) {
change = true;
storageSwitch.setNoStatus(s.isNoStatus());
}
if (s.isFault()) { if (s.isFault()) {
change = true; change = true;
} }
@ -148,5 +156,6 @@ public class StorageSwitch extends StorageMayOutOfOrderDevice {
s.setReversePosition(reversePosition != null ? reversePosition : false); s.setReversePosition(reversePosition != null ? reversePosition : false);
s.setDelayTime(delayTime != null ? delayTime : 0); s.setDelayTime(delayTime != null ? delayTime : 0);
s.setSplit(split != null ? split : false); s.setSplit(split != null ? split : false);
s.setNoStatus(noStatus != null ? noStatus : false);
} }
} }

View File

@ -1,8 +1,8 @@
package club.joylink.rtss.simulation.cbtc.data.vo; package club.joylink.rtss.simulation.cbtc.data.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.data.map.PSD; import club.joylink.rtss.simulation.cbtc.data.map.PSD;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -26,6 +26,9 @@ public class PSDStatusVO extends DeviceStatusVO {
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean interlockRelease; private Boolean interlockRelease;
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean noStatus;
public PSDStatusVO(PSD psd) { public PSDStatusVO(PSD psd) {
super(psd.getCode(), psd.getDeviceType()); super(psd.getCode(), psd.getDeviceType());
} }

View File

@ -52,6 +52,9 @@ public class SectionStatusVO extends DeviceStatusVO {
/**最高限速*/ /**最高限速*/
private Integer speedUpLimit; private Integer speedUpLimit;
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean noStatus;
private String fault; private String fault;
public SectionStatusVO(Section section) { public SectionStatusVO(Section section) {

View File

@ -1,9 +1,9 @@
package club.joylink.rtss.simulation.cbtc.data.vo; 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.data.map.Signal; import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; 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.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -44,6 +44,9 @@ public class SignalStatusVO extends DeviceStatusVO{
@JsonInclude(JsonInclude.Include.ALWAYS) @JsonInclude(JsonInclude.Include.ALWAYS)
private Integer remainTime; private Integer remainTime;
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean noStatus;
/** 信号机故障 */ /** 信号机故障 */
@JsonInclude(JsonInclude.Include.ALWAYS) @JsonInclude(JsonInclude.Include.ALWAYS)
private String fault; private String fault;

View File

@ -1,9 +1,9 @@
package club.joylink.rtss.simulation.cbtc.data.vo; 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.data.map.Stand; import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; 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.Getter;
import lombok.Setter; import lombok.Setter;
@ -67,6 +67,9 @@ public class StandStatusVO extends DeviceStatusVO {
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean parkingAlwaysValid; private Boolean parkingAlwaysValid;
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean noStatus;
/**故障*/ /**故障*/
@JsonInclude(JsonInclude.Include.ALWAYS) @JsonInclude(JsonInclude.Include.ALWAYS)
private String fault; private String fault;

View File

@ -1,9 +1,9 @@
package club.joylink.rtss.simulation.cbtc.data.vo; 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.data.map.Switch; import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; 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.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -47,6 +47,9 @@ public class SwitchStatusVO extends DeviceStatusVO {
@JsonInclude @JsonInclude
private Integer delayTime; private Integer delayTime;
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean noStatus;
public SwitchStatusVO(Switch aSwitch) { public SwitchStatusVO(Switch aSwitch) {
super(aSwitch.getCode(), aSwitch.getDeviceType()); super(aSwitch.getCode(), aSwitch.getDeviceType());
} }